☰ INDEX
ADH
Acid Base Balance
Basal Ganglia & Cerebellum
Basics of ECG Understanding
Basics
Body Fluids
Bradyarrhythmias
Calcium Metabolism
Cardiac Muscle
Cardiac Output (Integrated) (Part 1)
Cardiac Output (Integrated) (Part 2)
Cardiovascular Regulation & Reflexes
Cell & General Physiology
Coronary Blood Flow
Excitation Conduction Cardiac Vectors
Female Reproductive Hormones
Gas Exchange - V_Q Ratio
Gas Exchange
Glomerulus
Glucocorticoid
Hypoxia
Insulin
Integrative Neurophysiology - Cerebral Cortex
Integrative Neurophysiology - Learning & Memory
Integrative Neurophysiology - Thalamus & Hypothalamus
Integrative Neurophysiology – Sleep & EEG
Introduction to Endocrinology
Localization of Myocardial Damage with ECG
Male Reproductive Hormones
Membrane Potentials
Mineralocorticoid
Motor Functions
Nephron Structure
Nerve Fiber Classification
Neuro Muscular Junction & Muscle Contraction
Normal ECG
Olfaction & Taste
Pathophysiology of Muscle Contraction
Physiology Of Vision
Physiology of Audition
Physiology of GIT
Physiology of Pregnancy
Platelets & Homeostasis
Pressure, Flow & Resistance
Prolactin
Pulmonary Vasculature
Pulmonary Ventilation - Compliance & Surface Tension
Pulmonary Ventilation - Lung Volume & Capacities
Pulmonary Ventilation - Minute Ventilation & Dead Spaces
Pulmonary Ventilation - Obstructive Vs Restrictive Lung Disease
Pulmonary Ventilation - Respiratory Muscles, Pressures
RBC (Part 1)
RBC (Part 2)
Regulation Of Respiration
Sensory Functions
Structure of Skeletal Muscle Cell
Structure, Channels, Myelination & Conduction
Swallowing & Esophagus
Thyroid Axis
Transport Across Membrane (Part 1)
Transport Across Membrane (Part 2)
Transport of Gases
Tubular Functions
Types of Muscle Fibers
Vasculature
WBC & Immunity
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A 20-year-old patient complains of morbid thirst and hyper diuresis (up to 10 Liters daily). Glucose concentration in blood is normal but it is absent in urine. The patient has been diagnosed with diabetes insipidus. What hormonal drug is the most appropriate for the management of this disorder?", "options": [{"label": "A", "text": "Thyroxine", "correct": false}, {"label": "B", "text": "Oxytocin", "correct": false}, {"label": "C", "text": "Vasopressin", "correct": true}, {"label": "D", "text": "Cortisol", "correct": false}], "correct_answer": "C. Vasopressin", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Vasopressin Diabetes insipidus is characterized by morbid thirst and hyper diuresis with no alterations of glucose levels in blood and urine. The cause of this disease is the deficiency of vasopressin (antidiuretic hormone), so the administration of vasopressin is the most appropriate treatment.</p>\n<p><strong>Highyeild:</strong></p><p>Drug Class: Vasoconstrictor & Anti-Diuretic Hormone (ADH) Mechanism of Action: Supraphysiologic concentrations: vasopressin constricts arterial blood vessels by binding to vascular V1 vascular receptors. This makes it potentially useful in maintaining arterial blood pressure in a setting of cardiac arrest. Normal physiologic concentrations: Stimulation of V2 receptors in the cell membrane of the collecting duct promotes the translocation and insertion of aquaporin 2 water channel containing vesicles, into the collecting duct apical membrane. Indications: The management of cardiac arrest Treatment of diabetes insipidus To control polydipsia, polyuria, and dehydration caused by a deficiency of endogenous ADH (neurohypophyseal diabetes insipidus). Desmopressin (a synthetic V2 agonist) is usually considered the drug of choice. treatment of postoperative abdominal distension</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options: Option A. Thyroxine increases the rate of chemical reactions in cells and helps control growth and development. Option B. The two main physical functions of oxytocin are to stimulate uterine contractions in labor and childbirth and to stimulate contractions of breast tissue to aid in lactation after childbirth. Option D. Cortisol helps to maintain blood pressure, immune function, and the body's anti-inflammatory processes.</p>\n<p><strong>Extraedge:</strong></p><p>Schematic of the pituitary gland, the release of ADH (vasopressin), and its major cardiovascular effects. .</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following statements about ADH is incorrect?", "options": [{"label": "A", "text": "It increases aquaporin expression on the apical membrane", "correct": false}, {"label": "B", "text": "It increases urine concentration and decreases urine flow", "correct": false}, {"label": "C", "text": "Post-operative secretion is high", "correct": false}, {"label": "D", "text": "Its secretion occurs when plasma osmolality is low", "correct": true}], "correct_answer": "D. Its secretion occurs when plasma osmolality is low", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Its secretion occurs when plasma osmolality is low ADH secretion reduces when the plasma osmolality becomes low. ADH causes water reabsorption and dilutes the plasma, thereby causing a reduction in plasma osmolality.</p>\n<p><strong>Highyeild:</strong></p><p>Antidiuretic hormone (ADH) is a chemical produced in the brain that causes the kidneys to release less water, decreasing the amount of urine produced. A high ADH level causes the body to produce less urine. A low-level results in greater urine production.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. The antidiuretic effect of ADH is mediated via a G protein-coupled V2 receptor that increases intracellular cyclic AMP, thereby inducing translocation of aquaporin 2 (AQP 2) water channels into the apical membrane. Option: B. ADH increases urine concentration and decreases urine flow Option: C. During and after surgery, surgical stress results in the release of ADH.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 57-year-old woman is undergoing a femoral-popliteal bypass for her peripheral vascular disease. The vascular surgeon wishes to induce a localized arteriolar constriction to help control hemostasis. An increase in the local concentration of which of the following agents will cause systemic vasoconstriction?", "options": [{"label": "A", "text": "Nitric oxide", "correct": false}, {"label": "B", "text": "Angiotensin II", "correct": true}, {"label": "C", "text": "Atrial natriuretic peptide", "correct": false}, {"label": "D", "text": "Beta 2-adrenergic agonist", "correct": false}], "correct_answer": "B. Angiotensin II", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Angiotensin II Angiotensin II is a powerful vasoconstrictor that is formed when renin is released from the kidney in response to a fall in blood pressure or vascular volume.</p>\n<p><strong>Highyeild:</strong></p><p>Renin converts angiotensinogen to angiotensin I. Angiotensin II is formed from angiotensin I by angiotensin-converting enzymes localized within the vasculature of the lung. All the other listed substances cause vasodilation. Angiotensin II is the main effector molecule of the RAS. It causes increases in blood pressure, influences renal tubules to retain sodium and water, and stimulates aldosterone release from the adrenal gland.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Option:- Option: A. Nitric oxide, NO mainly produces vasodilation by the eNOS/NO/cGMP pathway. Option: C. ANP causes vasodilatation of the blood vessels which supply the glomeruli and vasoconstriction of the arterioles which drain them. Option: D. β2 adrenergic agonists' effects on smooth muscle cause dilation of bronchial passages, vasodilation in muscle and liver, relaxation of uterine muscle, and release of insulin .</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 45-year-old man develops a brain tumor that impinges on the supraoptic nucleus in the hypothalamus. As a result, the secretion of which of the following hormones is affected?", "options": [{"label": "A", "text": "Adrenocorticotropic hormone (ACTH)", "correct": false}, {"label": "B", "text": "Antidiuretic hormone (ADH)", "correct": true}, {"label": "C", "text": "Follicle-stimulating hormone (FSH)", "correct": false}, {"label": "D", "text": "Growth hormone", "correct": false}], "correct_answer": "B. Antidiuretic hormone (ADH)", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Antidiuretic hormone (ADH) ADH secretion reduces when the plasma osmolality becomes low. ADH causes water reabsorption and dilutes the plasma, thereby causing a reduction in plasma osmolality . ADH, also called arginine vasopressin , is secreted from the posterior lobe of the pituitary gland (neurohypophysis) into the general circulation from the endings of supra-optic neurons in the hypothalamus .</p>\n<p><strong>Highyeild:</strong></p><p>Antidiuretic hormone (ADH) is a chemical produced in the brain that causes the kidneys to release less water, decreasing the amount of urine produced. A high ADH level causes the body to produce less urine. A low-level results in greater urine production.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options: A, C, D: ACTH, FSH, and growth hormones are all secreted by the anterior pituitary gland (adenohypophysis) into the portal hypophyseal circulation from the endings of arcuate and other hypothalamic neurons.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 15-year-old boy visited the OPD of a hospital with the complaint of generalized body weakness, and increased frequency of urine. He is also having excessive thirst. He told the doctor, \"Sir, I don’t know what has happened to my body, I keep on drinking more and more water, but still, my thirst for water doesn't go away and I just spend my day in the washroom urinating”. Upon taking further history it was known that he also suffered from a skull 3 weeks back. His vitals were taken and are as follows: BP-98/60 mm hg PR-122/min A Urine examination was sent and the reports are as follows: Urine color-pale Specific gravity- 0.90 Which of the following hormone analogs should be prescribed to this patient for treatment?", "options": [{"label": "A", "text": "Aldosterone", "correct": false}, {"label": "B", "text": "ACTH", "correct": false}, {"label": "C", "text": "Angiotensin 2", "correct": false}, {"label": "D", "text": "ADH", "correct": true}], "correct_answer": "D. ADH", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>ADH The patient is suffering from polyuria and polydipsia and he also had a head injury a few weeks back. Instead of drinking much water, he is not able to maintain his fluid loss from his The specific gravity of the urine is low. So, more water is present in urine. All of this indicates that the patient is suffering from central diabetes insipidus. Low BP is due to significant fluid loss and tachycardia is due to reflex response from ADH should be prescribed to this patient which will increase water absorption from renal tubules. So the correct answer is D.</p>\n<p><strong>Highyeild:</strong></p><p>Antidiuretic hormone (ADH) is a chemical produced in the brain that causes the kidneys to release less water, decreasing the amount of urine produced. A high ADH level causes the body to produce less urine. A low-level results in greater urine production.</p>\n<p><strong>Random:</strong></p><p>Explanation for incorrect Options:- Option: A. Aldosterone will increase water absorption along with sodium and throw out hydrogen ions and potassium, thereby altering acid-base balance of the body. So, A is not correct. Option: B. ACTH leads to the synthesis of glucocorticoids with no direct impact on the above condition. So, B is false. Option: C. Angiotensin 2 is also not true for this condition.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the pairs regarding vasopressin is incorrect?", "options": [{"label": "A", "text": "V1- vascular smooth muscles", "correct": false}, {"label": "B", "text": "V2-distal collecting ducts", "correct": false}, {"label": "C", "text": "V3-anterior pituitary", "correct": false}, {"label": "D", "text": "V4-CNS", "correct": true}], "correct_answer": "D. V4-CNS", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>V4-CNS V4 Vasopressin receptors is Incorrectly paired with CNS</p>\n<p><strong>Highyeild:</strong></p><p>There are at least three kinds of vasopressin receptors.V1A receptors mediate the vasoconstrictor effect of vasopressin, and vasopressin is a potent stimulator of vascular smooth muscle in vitro. The mechanism by which vasopressin exerts its antidiuretic effect is activated by V2 receptors and involves the insertion of proteins called water channels into the apical (luminal) membranes of the principal cells of the collecting ducts. The V1B receptors (also called V3 receptors) appear to be unique to the anterior pituitary, where they mediate increased adrenocorticotropic hormone (ACTH) secretion from the corticotrophs.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Vasopressin Receptor and Location Option: A. Vasopressin Receptor V1 ; Location Vascular smooth muscle in the systemic , splanchnic , renal , and coronary circulations Kidneys, myometrium, bladder, adipocytes, hepatocytes, platelets, spleen, and testis. Option: B. Vasopressin Receptor V2 ; Location Distal convoluted tubules and medullary collecting ducts in the kidneys, Endothelium Option: C. Vasopressin Receptor V3 ; Location Pituitary</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "All Use cAMP as a secondary messenger except :-", "options": [{"label": "A", "text": "Corticotropin", "correct": false}, {"label": "B", "text": "Dopamine", "correct": false}, {"label": "C", "text": "Glucagon", "correct": false}, {"label": "D", "text": "Vasopressin V1", "correct": true}], "correct_answer": "D. Vasopressin V1", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Vasopressin V1 Vasopressin V1 does not use cAMP as a secondary messenger but Yes Vasopressin V2.</p>\n<p><strong>Highyeild:</strong></p><p>Hormones That Use the Adenylyl Cyclase-cAMP Second Messenger System:- Adrenocorticotropic hormone (ACTH) Angiotensin II (epithelial cells) Calcitonin Catecholamines (ẞ receptors) Corticotropin-releasing hormone (CRH) Follicle-stimulating hormone (FSH) Glucagon Growth hormone-releasing hormone (GHRH) Human chorionic gonadotropin (hCG) Luteinizing hormone (LH) Parathyroid hormone (PTH) Secretin Somatostatin Thyroid-stimulating hormone (TSH) Vasopressin (V2 receptor, epithelial cells)only</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A, B, and C Use cAMP as a secondary messenger.</p>\n<p><strong>Extraedge:</strong></p><p>Adenylyl cyclase Mechanism (CAMP) Phospholipase C Mechanism (IP 3 /Ca 2+ ) Steroid Hormone Mechanism Tyrosine Kinase Mechanism Guanylate cyclase Mechanism (cGMP) ACTH GnRH Glucocorticoids Insulin Atrial natriuretic LH TRH Estrogen IGF-1 peptide (ANP) FSH CHRH Progesterone Growth hormone Nitric oxide (NO) TSH Angiotensin II Testosterone Prolactin ADH (V 2 receptor) ADH (V 3 receptor) Aldosterone HCG Oxytocin 1.25-Dihydroxycholecalciferol MSH α 3 Receptors Thyroid hormones CRH Calcitonin PTH Glucagon β 1 and β 2 receptors Second messengers for various hormones</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 17 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A 3-year-old boy comes to your clinic with puffy eyes and generalized edema all over the body. Urine output is low. Proteinuria, no blood in the urine. What is the cause of edema?", "options": [{"label": "A", "text": "Built up of body fluids outside tissue.", "correct": false}, {"label": "B", "text": "The increase in the fluid is related to increased leakage from the blood", "correct": true}, {"label": "C", "text": "Reduced removal by the lymph system", "correct": false}, {"label": "D", "text": "The thyroid is responsible for edema", "correct": false}], "correct_answer": "B. The increase in the fluid is related to increased leakage from the blood", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The increase in the fluid is related to increased leakage from the blood In the nephrotic syndrome, abnormal sodium and water retention occur at the kidney level which ultimately causes expansion of interstitial volume and edema. The mechanisms and factors involved remain ill-defined. Increased sodium and water in blood will lead to increased Hydrostatic force in the capillaries leading to increased leakage and the fluid gets collected in the subcutaneous tissue. This edema in renal disorders is first evident around the eyes and face where loose connective tissue is present.</p>\n<p><strong>Highyeild:</strong></p><p>Edema is one of the clinical hallmarks of nephrotic syndrome. In some individuals, activation of the renin-angiotensin-aldosterone system leads to excessive sodium retention with an expansion of the extracellular fluid volume and edema.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A: Edema is built up of body fluids within the Option C: Reduced clearance of lymph is seen in disorders that cause blockage in Lymphatic circulation such as Filariasis and lymphadenopathy or tumors . Option D: The given situation is nephrotic syndrome. In minimal change disease, kidneys are responsible for the edema. However, edema is often observed in the feet, ankles, and legs but can happen in many areas of the body in response to disease including those of the heart, lungs, liver, kidney, or thyroid.</p>\n<p><strong>Table:</strong></p><p>TYPE ETIOLOGY CLINICAL PRESENTATION EXAMPLES Nephritic syndrome Glomerular inflammation → GBM damage → loss of\n RBCs into urine → dysmorphic RBCs, hematuria Hematuria, RBC casts in urine GFR→ oliguria,\n azotemia ↑ renin release, HTN Proteinuria often in the subnephrotic range (<\n 3.5 g/ day) but in severe cases may be in nephrotic\n range Nephrotic syndrome Podocyte damage impaired charge barrier →\n proteinuria Massive proteinuria (> 3.5 g/day) with edema,\n hypoalbuminemia →t hepatic lipogenesis → hypercholesterolemia Frothy urine with fatty casts Associated with hypercoagulable state due\n to antithrombin III loss in urine and ↑ risk of infection (loss of IgGs in urine and soft tissue\n compromise by edema) May be 1° (eg, direct podocyte damage) or 2°\n (podocyte damage from systemic process): ■ Focal segmental glomerulosclerosis (1° or 2°) ■ Minimal change disease (1° or 2°) Membranous nephropathy (1° or 2°) ■ Amyloidosis (2°) ■ Diabetic glomerulonephropathy (2°) Nephritic-nephrotic syndrome Severe GBM damage loss of RBCs into urine +\n impaired charge barrier hematuria + proteinuria Nephrotic-range proteinuria (>3.5 g/day) and\n concomitant features of nephritic syndrome Can occur with any form of nephritic syndrome,\n but is most common with: - Diffuse proliferative glomerulonephritis ■ Membranoproliferative glomerulonephritis</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A patient with high-grade fever for the last 5 days presents with ecchymosis and mucosal bleeding. BP is 90/60mmHg. You start the patient on IVF. What effect will it cause on ICF and ECF?", "options": [{"label": "A", "text": "ECF volume increase ICF volume no change ECF osmolarity o change ICF osmolarity no change", "correct": true}, {"label": "B", "text": "ECF volume decrease ICF volume no change ECF osmolarity no change ICF osmolarity no change", "correct": false}, {"label": "C", "text": "ECF volume increase ICF volume decrease ECF osmolarity increase ICF osmolarity increase", "correct": false}, {"label": "D", "text": "ECF volume increase ICF volume increase ECF osmolarity decrease ICF osmolarity decrease", "correct": false}], "correct_answer": "A. ECF volume increase ICF volume no change ECF osmolarity o change ICF osmolarity no change", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>ECF volume increase ICF volume no change ECF osmolarity o change ICF osmolarity no change ICF volume has no change ECF osmolarity has no change ICF osmolarity has no change Isotonic saline solution is added to the extracellular fluid compartment. Osmolarity of ECF doesn't change there for no osmosis, no change in ECF and ICF osmolarity.</p>\n<p><strong>Highyeild:</strong></p><p>When you start the patient on intravenous fluids (IVF), it will increase the volume of the extracellular fluid (ECF). This is because IVF is being administered into the bloodstream, which is part of the ECF compartment. The increase in ECF volume will also increase blood pressure. As for the intracellular fluid (ICF), the IVF will not have a direct effect on its volume or osmolarity. This is because the ICF is located inside the cells, which are separated from the bloodstream by cell membranes. Overall, the effect of IVF administration will be an increase in ECF volume and no change in ICF volume or osmolarity. It is important to note that the specific type and rate of IVF administration can also have additional effects on electrolyte balance, acid-base status, and other factors related to fluid and electrolyte homeostasis.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Nephrologist in the metro hospital presented a case of generalized dysfunction of proximal tubules causing loss of solutes like phosphate, uric acid, glucose, amino acids, low-molecular-weight proteins, and bicarbonate in a male patient of age 32 years working in the factory. The patient was diagnosed with proximal RTA. Select the incorrect?", "options": [{"label": "A", "text": "Autosomal recessive inheritance", "correct": false}, {"label": "B", "text": "X-linked inheritance", "correct": true}, {"label": "C", "text": "Impaired Na+/HCO3−symporter", "correct": false}, {"label": "D", "text": "Failure of the PCT cells to reabsorb filtered bicarbonate from the filtrate", "correct": false}], "correct_answer": "B. X-linked inheritance", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>X-linked inheritance Proximal RTA autosomal recessive inheritance pattern.</p>\n<p><strong>Highyeild:</strong></p><p>Renal tubular acidosis (RTA) is a medical condition that involves an accumulation of acid in the body due to a failure of the kidneys to appropriately acidify the urine Proximal RTA (pRTA) is caused by a failure of the proximal tubular cells to reabsorb filtered bicarbonate from the urine, leading to urinary bicarbonate wasting and subsequent acidemia. Reabsorption of bicarbonate is typically 80-90% in the proximal tubule and failure of this process leads to decreased systemic buffer and metabolic acidosis.</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option A. RTA is the autosomal recessive inheritance Option C. RTA is associated with impaired Na+/HCO3−symporter Option D. There is a failure of the PCT cells to reabsorb filtered bicarbonate from the filtrate</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A male patient aged 46 years was taken in a state of unconsciousness to the emergency ward of the hospital. Blood gas analysis reported PCO2 18 mm Hg, HCO3 – 5.6 mmol/l, and pH 7.2. Select the correct acid-base disorder?", "options": [{"label": "A", "text": "Metabolic Acidosis", "correct": true}, {"label": "B", "text": "Metabolic Alkalosis", "correct": false}, {"label": "C", "text": "Respiratory Acidosis", "correct": false}, {"label": "D", "text": "Respiratory Alkalosis", "correct": false}], "correct_answer": "A. Metabolic Acidosis", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Metabolic Acidosis This is the case of metabolic acidosis & partially compensated because pH is acidic and low which is 7.2 , pCO2 is low and HCO3 is also low.</p>\n<p><strong>Highyeild:</strong></p><p>Metabolic acidosis is a serious electrolyte disorder characterized by an imbalance in the body's acid-base balance. Metabolic acidosis has three main root causes: increased acid production, loss of bicarbonate, and a reduced ability of the kidneys to excrete excess acids. Metabolic acidosis can lead to acidemia, which is defined as arterial blood pH that is lower than 7.35. Acidemia and acidosis are not mutually exclusive – pH and hydrogen ion concentrations also depend on the coexistence of other acid-base disorders; therefore, pH levels in people with metabolic acidosis can range from low, normal, to high</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. Metabolic Alkalosis - Alkalosis is a condition in which the body fluids have an excess base (alkali). This is the opposite of excess acid (acidosis). Option C. Respiratory Acidosis - Respiratory acidosis is a condition that occurs when the lungs cannot remove all of the carbon dioxides the body produces. This causes body fluids, especially the blood, to become too acidic. Option D. Respiratory Alkalosis - Respiratory alkalosis occurs when high levels of carbon dioxide disrupt the blood's acid-base balance. It often occurs in people who experience rapid, uncontrollable breathing (hyperventilation). Treatment includes supplemental oxygen and therapies to reduce the risk of hyperventilation.</p>\n<p><strong>Extraedge:</strong></p><p>Table 31-3 Extracellular Fluid Characteristics of Primary Acid-Base Disturbances pH H + Pco 2 HCO 3 - Normal 7.4 40 mEq/L 40 mm Hg 24 mEq/L Respiratory acidosis ↓ ↑ ↑↑ ↑ Respiratory alkalosis ↑ ↓ ↓↓ ↓ Metabolic acidosis ↓ ↑ ↓ ↓↓ Metabolic alkalosis ↑ ↓ ↑ ↑↑ The primary event is indicated by the double arrows (↑↑ or↓↓ ). Note that respiratory acid-base disorders are initiated by an increase or decrease in Pco₂, whereas metabolic disorders are initiated by an increase or decrease in HCO 3 - .</p>\n<p><strong>Table:</strong></p><p>Acid-Base Physiology Acid-base physiology Metabolic acid-base disorders cause HCO3\n alterations. Respiratory acid-base disorders cause Pco2 alterations. pH PCO 2 [HCO 3 ] COMPENSATORY RESPONSE Metabolic acidosis ↓ ↓ ↓ Hyperventilation (immediate) Metabolic alkalosis ↑ ↑ ↑ Hypoventilation (immediate) Respiratory ↓ ↑ ↑ ↑ renal [HCO3] reabsorption (delayed) Respiratory alkalosis ↑ ↓ ↓ ↓renal [HCO3] reabsorption (delayed) Key: ↑↓ compensatory response. Henderson-Hasselbalch equation: pH = 6.1 + log [HCO3] 0.03\nPco2 Predicted respiratory compensation for a simple\nmetabolic acidosis can be calculated using the Winters formula. If measured\nPco2> predicted Pco2→ concomitant respiratory acidosis; if measured\nPco2<predicted Pco ₂ →\nconcomitant respiratory alkalosis: Pco ₂ = 1.5[HCO 3 ]+8 土 2</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Male patient at the age of 32 years presented with manifestations of Hyperaldosteronism. Blood gas analysis reported arterial blood pH 7.6, pCO2 55 mmHg, and HCO3 - 42 mmol/l. Select the correct disorder?", "options": [{"label": "A", "text": "Metabolic Acidosis", "correct": false}, {"label": "B", "text": "Metabolic Alkalosis", "correct": true}, {"label": "C", "text": "Respiratory Acidosis", "correct": false}, {"label": "D", "text": "Respiratory Alkalosis", "correct": false}], "correct_answer": "B. Metabolic Alkalosis", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Metabolic Alkalosis Metabolic alkalosis is a metabolic condition in which the pH of tissue is elevated beyond the normal range (7.35–7.45). This is the result of decreased hydrogen ion concentration, leading to increased bicarbonate, or alternatively a direct result of increased bicarbonate concentrations. The condition typically cannot last long if the kidneys are functioning properly.</p>\n<p><strong>Highyeild:</strong></p><p>Metabolic alkalosis is the primary increase in bicarbonate (HCO3−) with or without a compensatory increase in carbon dioxide partial pressure ( pCO 2); pH may be high or nearly normal. Common causes include prolonged vomiting, hypovolemia, diuretic use, and hypokalemia.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Metabolic Acidosis - Metabolic acidosis can lead to acidemia, which is defined as arterial blood pH that is lower than 7.35 Option C. Respiratory Acidosis - Respiratory acidosis typically occurs due to failure of ventilation and accumulation of carbon dioxide Option D. Respiratory Alkalosis - Respiratory alkalosis is 1 of the 4 basic classifications of blood pH imbalances. Normal human physiological pH is 7.35 to 7.45. A decrease in pH below this range is acidosis, an increase above this range is alkalosis.</p>\n<p><strong>Extraedge:</strong></p><p>Table 31-3 Extracellular Fluid Characteristics of Primary Acid-Base Disturbances pH H + Pco 2 HCO 3 - Normal 7.4 40 mEq/L 40 mm Hg 24 mEq/L Respiratory acidosis ↓ ↑ ↑↑ ↑ Respiratory alkalosis ↑ ↓ ↓↓ ↓ Metabolic acidosis ↓ ↑ ↓ ↓↓ Metabolic alkalosis ↑ ↓ ↑ ↑↑ The primary event is indicated by the double arrows (↑↑ or↓↓ ). Note that respiratory acid-base disorders are initiated by an increase or decrease in Pco₂, whereas metabolic disorders are initiated by an increase or decrease in HCO 3 - .</p>\n<p><strong>Table:</strong></p><p>Acid-base physiology Metabolic acid-base disorders cause HCO3 alterations.\n Respiratory acid-base disorders cause Pco2 alterations. pH PCO 2 [HCO 3 ] COMPENSATORY RESPONSE Metabolic acidosis ↓ ↓ ↓ Hyperventilation (immediate) Metabolic alkalosis ↑ ↑ ↑ Hypoventilation (immediate) Respiratory ↓ ↑ ↑ ↑ renal [HCO3] reabsorption (delayed) Respiratory alkalosis ↑ ↓ ↓ ↓renal [HCO3] reabsorption (delayed)</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 24-year-old female in a fit of acute depression swallowed sleeping pills. The patient was taken to the emergency ward in comatose. Blood gas analysis of arterial blood samples reported pH – 6.7, HCO3 - 10 meq/liter, and PaCO2 70 mmHg. Select the correct condition of acid-base balance in the patient?", "options": [{"label": "A", "text": "Uncompensated metabolic acidosis", "correct": false}, {"label": "B", "text": "Uncompensated respiratory acidosis", "correct": false}, {"label": "C", "text": "Simultaneous respiratory and metabolic acidosis", "correct": true}, {"label": "D", "text": "Respiratory acidosis with partial renal compensation", "correct": false}], "correct_answer": "C. Simultaneous respiratory and metabolic acidosis", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Simultaneous respiratory and metabolic acidosis Respiratory centers in the pons and medulla control alveolar ventilation. Chemoreceptors for PCO2, PO2, and pH regulate ventilation . Central chemoreceptors in the medulla are sensitive to changes in the pH level. A decreased pH level influences the mechanics of ventilation and maintains proper levels of carbon dioxide and oxygen. When ventilation is disrupted, arterial PCO2 increases and an acid-base disorder develops.</p>\n<p><strong>Highyeild:</strong></p><p>Another pathophysiological mechanism may be due to the ventilation/perfusion mismatch of dead space. Sleeping pills induce extreme CNS depression and respiratory center depression in a drug overdose. It may induce hyperventilation leading to the accumulation of carbon dioxide. The primary disturbance is an elevated arterial partial pressure of carbon dioxide (pCO2) and a decreased ratio of arterial bicarbonate to arterial pCO2, which results in a decrease in the pH of the blood. Hypoventilation can further induce partial anaerobic conditions in muscles leading to the accumulation of lactic acid and lactic acidosis.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Uncompensated metabolic acidosis - Acute metabolic acidosis, lasting from minutes to several days, often occurs during serious illnesses or hospitalizations and is generally caused when the body produces an excess amount of organic acids (keto acids or lactic acid). Option B. Uncompensated respiratory acidosis - Respiratory acidosis can be subcategorized as acute, chronic, or acute and chronic. In acute respiratory acidosis, there is a sudden elevation of pCO2 because of the failure of ventilation. Option D. Respiratory acidosis with partial renal compensation - With renal compensation, renal excretion of carbonic acid is increased, and bicarbonate reabsorption is increased.</p>\n<p><strong>Extraedge:</strong></p><p>Table 31-3 Extracellular Fluid Characteristics of Primary Acid-Base Disturbances pH H + Pco 2 HCO 3 - Normal 7.4 40 mEq/L 40 mm Hg 24 mEq/L Respiratory acidosis ↓ ↑ ↑↑ ↑ Respiratory alkalosis ↑ ↓ ↓↓ ↓ Metabolic acidosis ↓ ↑ ↓ ↓↓ Metabolic alkalosis ↑ ↓ ↑ ↑↑ The primary event is indicated by the double arrows (↑↑ or↓↓ ). Note that respiratory acid-base disorders are initiated by an increase or decrease in Pco₂, whereas metabolic disorders are initiated by an increase or decrease in HCO 3 - .</p>\n<p><strong>Table:</strong></p><p>Acid-Base\nPhysiology Acid-base physiology Metabolic acid-base disorders cause HCO3 alterations. Respiratory\n acid-base disorders cause Pco2 alterations. pH PCO 2 [HCO 3 ] COMPENSATORY RESPONSE Metabolic acidosis ↓ ↓ ↓ Hyperventilation (immediate) Metabolic alkalosis ↑ ↑ ↑ Hypoventilation (immediate) Respiratory ↓ ↑ ↑ ↑ renal [HCO3] reabsorption (delayed) Respiratory alkalosis ↑ ↓ ↓ ↓renal [HCO3] reabsorption (delayed) Key:\n↑↓ compensatory response. Henderson-Hasselbalch\nequation: pH = 6.1 + log [HCO3] 0.03\nPco2 Predicted\nrespiratory compensation for a simple metabolic acidosis can be calculated\nusing the Winters formula. If measured Pco2> predicted Pco2→ concomitant\nrespiratory acidosis; if measured Pco2<predicted Pco ₂ →\nconcomitant respiratory alkalosis: Pco ₂ = 1.5[HCO 3 ]+8 土 2</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A young student in MBBS 1st year was apprehensive and nervous before attempting the examination. His pulse rate is 95/min, and minute ventilation is 8.6 L per minute. What could be expected from the above event?", "options": [{"label": "A", "text": "Metabolic Acidosis", "correct": false}, {"label": "B", "text": "Metabolic Alkalosis", "correct": false}, {"label": "C", "text": "Respiratory Acidosis", "correct": false}, {"label": "D", "text": "Respiratory Alkalosis", "correct": true}], "correct_answer": "D. Respiratory Alkalosis", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Respiratory Alkalosis Respiratory alkalosis is induced by a process involving hyperventilation.</p>\n<p><strong>Highyeild:</strong></p><p>These include central causes, hypoxemic causes, pulmonary causes, and iatrogenic causes. Central sources are head injury, stroke, hyperthyroidism, anxiety-hyperventilation, pain, fear, stress, drugs, medications such as salicylates, and various toxins. Since the primary cause of all respiratory alkalosis etiologies is hyperventilation, many patients present with complaints of shortness of breath.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Metabolic Acidosis - It can be caused by chronic alcohol use, heart failure, cancer, seizures, liver failure, prolonged lack of oxygen, and low blood sugar. Even prolonged exercise can lead to lactic acid buildup Option B. Metabolic Alkalosis - Metabolic alkalosis may be caused by consuming an excessive amount of certain medications or supplements such as: Antacids, which often contain the chemical sodium bicarbonate. Baking soda. Diuretics or water pills. Certain laxatives. Steroids Option C. Respiratory Acidosis - Causes of respiratory acidosis include: Diseases of the airways, such as asthma and COPD. Diseases of the lung tissue, such as pulmonary fibrosis, cause scarring and thickening of the lungs.</p>\n<p><strong>Extraedge:</strong></p><p>Table 31-3 Extracellular Fluid Characteristics of Primary Acid-Base Disturbances pH H + Pco 2 HCO 3 - Normal 7.4 40 mEq/L 40 mm Hg 24 mEq/L Respiratory acidosis ↓ ↑ ↑↑ ↑ Respiratory alkalosis ↑ ↓ ↓↓ ↓ Metabolic acidosis ↓ ↑ ↓ ↓↓ Metabolic alkalosis ↑ ↓ ↑ ↑↑ The primary event is indicated by the double arrows (↑↑ or↓↓ ). Note that respiratory acid-base disorders are initiated by an increase or decrease in Pco₂, whereas metabolic disorders are initiated by an increase or decrease in HCO 3 - .</p>\n<p><strong>Table:</strong></p><p>Acid-Base\nPhysiology Acid-base physiology Metabolic acid-base disorders cause HCO3 alterations. Respiratory\n acid-base disorders cause Pco2 alterations. pH PCO 2 [HCO 3 ] COMPENSATORY RESPONSE Metabolic acidosis ↓ ↓ ↓ Hyperventilation (immediate) Metabolic alkalosis ↑ ↑ ↑ Hypoventilation (immediate) Respiratory ↓ ↑ ↑ ↑ renal [HCO3] reabsorption (delayed) Respiratory alkalosis ↑ ↓ ↓ ↓renal [HCO3] reabsorption (delayed) Key:\n↑↓ compensatory response. Henderson-Hasselbalch\nequation: pH = 6.1 + log [HCO3] 0.03\nPco2 Predicted\nrespiratory compensation for a simple metabolic acidosis can be calculated\nusing the Winters formula. If measured Pco2> predicted Pco2→ concomitant\nrespiratory acidosis; if measured Pco2<predicted Pco ₂ →\nconcomitant respiratory alkalosis: Pco ₂ = 1.5[HCO 3 ]+8 土 2</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Male patient at age 45 years with 10 years H/O diabetes mellitus on medication with poor glycemic control as was revealed by past laboratory tests in the file of the patient. The patient suffered oliguria for the past 3 months and was diagnosed with diabetic nephropathy. The patient had poor compliance with hemodialysis. The patient suffered as a result of failure to go for dialysis past two events. Select the correct?", "options": [{"label": "A", "text": "Metabolic Acidosis", "correct": true}, {"label": "B", "text": "Metabolic Alkalosis", "correct": false}, {"label": "C", "text": "Respiratory Acidosis", "correct": false}, {"label": "D", "text": "Respiratory Alkalosis", "correct": false}], "correct_answer": "A. Metabolic Acidosis", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Metabolic Acidosis Metabolic acidosis is one of the most common consequences of chronic kidney disease (CKD), and its prevalence increases with the decline in glomerular filtration rate (GFR). \\</p>\n<p><strong>Highyeild:</strong></p><p>The kidney has a central role in maintaining bicarbonate homeostasis by reabsorbing the filtered bicarbonate in the proximal tubule. When the functional renal mass is reduced, as in CKD, impairment of renal acid handling occurs, leading to acidemia and consumption of bicarbonate in order to buffer the retained acid.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. Metabolic Alkalosis - Metabolic acidosis is a serious electrolyte disorder characterized by an imbalance in the body's acid-base balance. Metabolic acidosis has three main root causes: increased acid production, loss of bicarbonate, and a reduced ability of the kidneys to excrete excess acids Option C. Respiratory Acidosis - Respiratory acidosis can be subcategorized as acute, chronic, or acute and chronic . In acute respiratory acidosis, there is a sudden elevation of pCO2 because of failure of ventilation Option D. Respiratory Alkalosis - Respiratory alkalosis is 1 of the 4 basic classifications of blood pH imbalances. Normal human physiological pH is 7.35 to 7.45. A decrease in pH below this range is acidosis, an increase above this range is alkalosis.</p>\n<p><strong>Extraedge:</strong></p><p>Extracellular Fluid Characteristics of Primary Acid-Base Disturbances pH H + Pco 2 HCO 3 - Normal 7.4 40 mEq/L 40 mm Hg 24 mEq/L Respiratory acidosis ↓ ↑ ↑↑ ↑ Respiratory alkalosis ↑ ↓ ↓↓ ↓ Metabolic acidosis ↓ ↑ ↓ ↓↓ Metabolic alkalosis ↑ ↓ ↑ ↑↑ The primary event is indicated by the double arrows (↑↑ or↓↓ ). Note that respiratory acid-base disorders are initiated by an increase or decrease in Pco₂, whereas metabolic disorders are initiated by an increase or decrease in HCO 3 - .</p>\n<p><strong>Table:</strong></p><p>Acid-Base\nPhysiology Acid-base physiology Metabolic acid-base disorders cause HCO3 alterations. Respiratory\n acid-base disorders cause Pco2 alterations. pH PCO 2 [HCO 3 ] COMPENSATORY RESPONSE Metabolic acidosis ↓ ↓ ↓ Hyperventilation (immediate) Metabolic alkalosis ↑ ↑ ↑ Hypoventilation (immediate) Respiratory ↓ ↑ ↑ ↑ renal [HCO3] reabsorption (delayed) Respiratory alkalosis ↑ ↓ ↓ ↓renal [HCO3] reabsorption (delayed) Key:\n↑↓ compensatory response. Henderson-Hasselbalch\nequation: pH = 6.1 + log [HCO3] 0.03\nPco2 Predicted\nrespiratory compensation for a simple metabolic acidosis can be calculated\nusing the Winters formula. If measured Pco2> predicted Pco2→ concomitant\nrespiratory acidosis; if measured Pco2<predicted Pco ₂ →\nconcomitant respiratory alkalosis: Pco ₂ = 1.5[HCO 3 ]+8 土 2</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A male patient of 78 years suffered from an attack of cough and cold past 7 days. He took medication from a local physician. Later on, he was taken to the hospital for the presentation of difficulty in breathing, chest heaviness, and frequent bouts of cough. Select the correct acid-base disorder in the condition?", "options": [{"label": "A", "text": "Metabolic Acidosis", "correct": false}, {"label": "B", "text": "Metabolic Alkalosis", "correct": false}, {"label": "C", "text": "Respiratory Acidosis", "correct": true}, {"label": "D", "text": "Respiratory Alkalosis", "correct": false}], "correct_answer": "C. Respiratory Acidosis", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Respiratory Acidosis In COPD patients, chronically elevated carbon dioxide shifts the normal acid-base balance toward acidic. There is the retention of carbon dioxide, which is hydrated to form carbonic acid. Carbonic acid is a weak and volatile acid that quickly dissociates to form hydrogen and bicarbonate ions. This results in respiratory acidosis. This primary event is characterized by increased pCO2 and a fall in pH on arterial blood gas analysis.</p>\n<p><strong>Highyeild:</strong></p><p>The consequence of hypercapnia due to the alteration of gas exchange in COPD patients mainly consists of an increase in H+ concentration and the development of respiratory acidosis, also called hypercapnic acidosis. Consequently, the compensation to respiratory acidosis consists of a secondary increase in bicarbonate concentration, and the arterial blood gas analysis is characterized by a reduced pH, increased pCO2 (initial variation), and increased bicarbonate levels (compensatory response).</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Metabolic Acidosis - Acute metabolic acidosis, lasting from minutes to several days, often occurs during serious illnesses or hospitalizations and is generally caused when the body produces an excess amount of organic acids (keto acids or lactic acid). Option B. Metabolic Alkalosis - Metabolic alkalosis is a metabolic condition in which the pH of tissue is elevated beyond the normal range (7.35–7.45). Option D. Respiratory Alkalosis - HCO3 functions as an alkalotic substance. CO2 (carbon dioxide) functions as an acidic substance. Therefore, Increases in HCO3 (bicarbonate) or decreases in CO2 will make blood more alkalotic.</p>\n<p><strong>Extraedge:</strong></p><p>Extracellular Fluid Characteristics of Primary Acid-Base Disturbances pH H + Pco 2 HCO 3 - Normal 7.4 40 mEq/L 40 mm Hg 24 mEq/L Respiratory acidosis ↓ ↑ ↑↑ ↑ Respiratory alkalosis ↑ ↓ ↓↓ ↓ Metabolic acidosis ↓ ↑ ↓ ↓↓ Metabolic alkalosis ↑ ↓ ↑ ↑↑ The primary event is indicated by the double arrows (↑↑ or↓↓ ). Note that respiratory acid-base disorders are initiated by an increase or decrease in Pco₂, whereas metabolic disorders are initiated by an increase or decrease in HCO 3 - .</p>\n<p><strong>Table:</strong></p><p>Acid-Base\nPhysiology Acid-base physiology Metabolic acid-base disorders cause HCO3 alterations. Respiratory\n acid-base disorders cause Pco2 alterations. pH PCO 2 [HCO 3 ] COMPENSATORY RESPONSE Metabolic acidosis ↓ ↓ ↓ Hyperventilation (immediate) Metabolic alkalosis ↑ ↑ ↑ Hypoventilation (immediate) Respiratory ↓ ↑ ↑ ↑ renal [HCO3] reabsorption (delayed) Respiratory alkalosis ↑ ↓ ↓ ↓renal [HCO3] reabsorption (delayed) Key:\n↑↓ compensatory response. Henderson-Hasselbalch\nequation: pH = 6.1 + log [HCO3] 0.03\nPco2 Predicted\nrespiratory compensation for a simple metabolic acidosis can be calculated\nusing the Winters formula. If measured Pco2> predicted Pco2→ concomitant\nrespiratory acidosis; if measured Pco2<predicted Pco ₂ →\nconcomitant respiratory alkalosis: Pco ₂ = 1.5[HCO 3 ]+8 土 2</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The Ryle tube was inserted in a female patient of 34 years who had undergone surgery to maintain dietary input. Tube in for three days. The attending nurse reported drainage from the Ryle tube and the patient was sick. Select the correct:", "options": [{"label": "A", "text": "Metabolic Acidosis", "correct": false}, {"label": "B", "text": "Metabolic Alkalosis", "correct": true}, {"label": "C", "text": "Respiratory Acidosis", "correct": false}, {"label": "D", "text": "Respiratory Alkalosis", "correct": false}], "correct_answer": "B. Metabolic Alkalosis", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Metabolic Alkalosis The Ryle tube is a type of nasogastric tube that is used to provide enteral feeding and/or remove stomach contents. In this case , the tube was inserted in a female patient who had undergone surgery to maintain dietary input. The tube was in place for three days, and during this time, the patient developed drainage from the tube and became sick. The drainage from the Ryle tube could be due to several factors, including infection, inflammation, or damage to the gastrointestinal tract. This drainage could lead to loss of fluid, electrolytes, and acid-base balance, which can result in metabolic alkalosis.</p>\n<p><strong>Highyeild:</strong></p><p>Metabolic alkalosis is a condition in which the pH of the blood is elevated above the normal range. This can occur when there is an excess of bicarbonate ions in the blood or a loss of hydrogen ions. In the case of the patient with the Ryle tube, the drainage from the tube could have resulted in a loss of gastric acid, which is important in maintaining acid-base balance in the body. This loss of acid could lead to an increase in the bicarbonate concentration in the blood, resulting in metabolic alkalosis. To address metabolic alkalosis, the underlying cause of the drainage from the Ryle tube needs to be identified and treated. Additionally, the patient may need to receive electrolyte replacement and acid-base management to correct the imbalance. Close monitoring of the patient's fluid and electrolyte status, as well as regular assessment of the Ryle tube site and function, will also be important to prevent further complications.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Metabolic Acidosis - Metabolic acidosis is a serious electrolyte disorder characterized by an imbalance in the body's acid-base balance. Option C. Respiratory Acidosis - Respiratory acidosis typically occurs due to failure of ventilation and accumulation of carbon dioxide. Option D. Res piratory Alkalosis - Respiratory alkalosis is by definition a disease state where the body’s pH is elevated to greater than 7.45 secondary to some respiratory or pulmonary process</p>\n<p><strong>Extraedge:</strong></p><p>Extracellular Fluid Characteristics of Primary Acid-Base Disturbances pH H + Pco 2 HCO 3 - Normal 7.4 40 mEq/L 40 mm Hg 24 mEq/L Respiratory acidosis ↓ ↑ ↑↑ ↑ Respiratory alkalosis ↑ ↓ ↓↓ ↓ Metabolic acidosis ↓ ↑ ↓ ↓↓ Metabolic alkalosis ↑ ↓ ↑ ↑↑ The primary event is indicated by the double arrows (↑↑ or↓↓ ). Note that respiratory acid-base disorders are initiated by an increase or decrease in Pco₂, whereas metabolic disorders are initiated by an increase or decrease in HCO 3 - .</p>\n<p><strong>Table:</strong></p><p>Acid-Base\nPhysiology Acid-base physiology Metabolic acid-base disorders cause HCO3 alterations. Respiratory\n acid-base disorders cause Pco2 alterations. pH PCO 2 [HCO 3 ] COMPENSATORY RESPONSE Metabolic acidosis ↓ ↓ ↓ Hyperventilation (immediate) Metabolic alkalosis ↑ ↑ ↑ Hypoventilation (immediate) Respiratory ↓ ↑ ↑ ↑ renal [HCO3] reabsorption (delayed) Respiratory alkalosis ↑ ↓ ↓ ↓renal [HCO3] reabsorption (delayed) Key:\n↑↓ compensatory response. Henderson-Hasselbalch\nequation: pH = 6.1 + log [HCO3] 0.03\nPco2 Predicted\nrespiratory compensation for a simple metabolic acidosis can be calculated\nusing the Winters formula. If measured Pco2> predicted Pco2→ concomitant\nrespiratory acidosis; if measured Pco2<predicted Pco ₂ →\nconcomitant respiratory alkalosis: Pco ₂ = 1.5[HCO 3 ]+8 土 2</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Routine food intake and consumption of several beverages, there should be a disturbance of acid-base balance. It is well maintained with the help of buffer systems. Select the correct for most effective buffer system:", "options": [{"label": "A", "text": "Bicarbonate buffer", "correct": true}, {"label": "B", "text": "Phosphate buffer", "correct": false}, {"label": "C", "text": "Protein buffer", "correct": false}, {"label": "D", "text": "All of the above", "correct": false}], "correct_answer": "A. Bicarbonate buffer", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Bicarbonate buffer The bicarbonate buffer system plays a vital role in other tissues as well. In the human stomach and duodenum, the bicarbonate buffer system serves to both neutralize gastric acid and stabilize the intracellular pH of epithelial cells via the secretion of bicarbonate ions into the gastric mucosa.</p>\n<p><strong>Highyeild:</strong></p><p>In tissue, cellular respiration produces carbon dioxide as a waste product; as one of the primary roles of the cardiovascular system, most of this CO2 is rapidly removed from the tissues by its hydration to bicarbonate ion The bicarbonate ion present in the blood plasma is transported to the lungs, where it is dehydrated back into CO2 and released during exhalation. These hydration and dehydration conversions of CO2 and H2CO3, which are normally very slow, are facilitated by carbonic anhydrase in both the blood and duodenum. While in the blood, bicarbonate ion serves to neutralize acid introduced to the blood through other metabolic processes (e.g. lactic acid, ketone bodies); likewise, any bases (e.g. urea from the catabolism of proteins) are neutralized by carbonic acid (H2CO3).</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. Phosphate buffer - Phosphate buffer system. The phosphate buffer consists of phosphoric acid (H3PO4) in equilibrium with dihydrogen phosphate ion (H2PO4–) and H+. The pK for the phosphate buffer is 6.8, which allows this buffer to function within its optimal buffering range at physiological pH. It plays a very minute role in the blood. Option C. Protein buffer - Nearly all proteins can function as buffers. Proteins are made up of amino acids, which contain positively charged amino groups and negatively charged carboxyl groups . The charged regions of these molecules can bind hydrogen and hydroxyl ions, and thus function as buffers.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Proteins are composed of amino acids. Each one has a positively charged amino group and a negatively charged carboxyl group linked to a central carbon. The charged domains can buffer acids and bases. But the protein-rich in specific amino acids has the highest buffering capacity at the physiological pH. select the correct?", "options": [{"label": "A", "text": "Lysine", "correct": false}, {"label": "B", "text": "Histidine", "correct": true}, {"label": "C", "text": "Aspartic acid", "correct": false}, {"label": "D", "text": "Leucine", "correct": false}], "correct_answer": "B. Histidine", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Histidine At physiological pH, histidine is the major buffering component of proteins. Histidine has a pKa of 6.2. However, this pKa changes when the histidine is bound to other amino acids resulting in a pKa range of 5-8 (Abe, 2000) . At physiological pH, histidine is the major buffering component of proteins.</p>\n<p><strong>Highyeild:</strong></p><p>In a histidine proton shuttle, histidine is used to quickly shuttle protons. It can do this by abstracting a proton with its basic nitrogen to make a positively charged intermediate and then using another molecule, a buffer, to extract the proton from its acidic nitrogen.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Lysine - Lysines are quite frequent in protein active or binding sites. Lysine contains a positively charged amino on its side chain that is sometimes involved in forming hydrogen bonds with negatively charged non-protein atoms. Option C. Aspartic acid - Aspartic acid is one of the building-block amino acids that are responsible for synthesizing proteins and regulating hormones in the human body Option D. Leucine - Leucine is an essential amino acid for protein synthesis. Additionally, similarly to other amino acids, the carbon skeleton of leucine can be used to generate ATP. However, leucine can also regulate several cellular processes such as protein synthesis, tissue regeneration, and metabolism</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A physiologist in a class test provided blood gas analysis parameters to students as arterial blood samples with plasma pH = 7.30, plasma HCO3 − = 35 mEq/L, and plasma pCO2 = 71 mm Hg. Select the correct acid-base disorder?", "options": [{"label": "A", "text": "Acute respiratory acidosis with renal compensation", "correct": false}, {"label": "B", "text": "Respiratory acidosis with partial renal compensation", "correct": true}, {"label": "C", "text": "Acute metabolic acidosis with respiratory compensation", "correct": false}, {"label": "D", "text": "Metabolic acidosis with partial respiratory compensation", "correct": false}], "correct_answer": "B. Respiratory acidosis with partial renal compensation", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Respiratory acidosis with partial renal compensation In respiratory acidosis, plasma pH is lower than the normal level of 7.4 and the plasma pCO2 is higher than the normal level of 40 mm Hg. The elevation in plasma bicarbonate concentration above normal (∼24 mEq/L) is due to partial renal compensation for respiratory acidosis. So the condition is respiratory acidosis with partial renal compensation.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Acute respiratory acidosis with renal compensation - Renal compensation of respiratory acidosis is by increased urinary excretion of hydrogen ions and resorption of HCO3− . This relatively slow process occurs over several days. Slowly, pH reaches low normal values, but HCO3− levels and BE are increased. Option C. Acute metabolic acidosis with respiratory compensation- Metabolic acidosis is defined as a low arterial blood pH in conjunction with a reduced serum HCO3− concentration. Respiratory compensation results in a decrease in Pa CO Option D. Metabolic acidosis with partial respiratory compensation- Partially compensated respiratory acidosis occurs when respiratory acidosis is present, with pH acidic (under 7.35) and PaCO ₂ acidic (over 45 mmHg); and the metabolic system acts to correct it, marked by an HCO ₃ level that's basic (over 26 mEq/L)</p>\n<p><strong>Extraedge:</strong></p><p>Extracellular Fluid Characteristics of Primary Acid-Base Disturbances pH H + Pco 2 HCO 3 - Normal 7.4 40 mEq/L 40 mm Hg 24 mEq/L Respiratory acidosis ↓ ↑ ↑↑ ↑ Respiratory alkalosis ↑ ↓ ↓↓ ↓ Metabolic acidosis ↓ ↑ ↓ ↓↓ Metabolic alkalosis ↑ ↓ ↑ ↑↑ The primary event is indicated by the double arrows (↑↑ or↓↓ ). Note that respiratory acid-base disorders are initiated by an increase or decrease in Pco₂, whereas metabolic disorders are initiated by an increase or decrease in HCO 3 - .</p>\n<p><strong>Table:</strong></p><p>Acid-Base\nPhysiology Acid-base physiology Metabolic acid-base disorders cause HCO3 alterations. Respiratory\n acid-base disorders cause Pco2 alterations. pH PCO 2 [HCO 3 ] COMPENSATORY RESPONSE Metabolic acidosis ↓ ↓ ↓ Hyperventilation (immediate) Metabolic alkalosis ↑ ↑ ↑ Hypoventilation (immediate) Respiratory ↓ ↑ ↑ ↑ renal [HCO3] reabsorption (delayed) Respiratory alkalosis ↑ ↓ ↓ ↓renal [HCO3] reabsorption (delayed) Key:\n↑↓ compensatory response. Henderson-Hasselbalch\nequation: pH = 6.1 + log [HCO3] 0.03\nPco2 Predicted\nrespiratory compensation for a simple metabolic acidosis can be calculated\nusing the Winters formula. If measured Pco2> predicted Pco2→ concomitant\nrespiratory acidosis; if measured Pco2<predicted Pco ₂ →\nconcomitant respiratory alkalosis: Pco ₂ = 1.5[HCO 3 ]+8 土 2</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Male patient of age 32 years presented with manifestations of glomerulonephritis. The GFR decreases by 50% to normal. Select the correct one that maximally increases in plasma:", "options": [{"label": "A", "text": "Creatinine", "correct": true}, {"label": "B", "text": "K+ ions", "correct": false}, {"label": "C", "text": "Glucose", "correct": false}, {"label": "D", "text": "Na+ ions", "correct": false}], "correct_answer": "A. Creatinine", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Creatinine A reduction in GFR to 50% would reduce the urinary excretion of creatinine by the It leads to double the plasma creatinine concentration. Therefore, when GFR decreases the plasma concentration of creatinine increases until the renal excretion of creatinine returns to normal.</p>\n<p><strong>Highyeild:</strong></p><p>Plasma phosphate concentration is also maintained near normal until GFR falls below 20% to 30% of normal.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Options B, C & D - Plasma concentrations of glucose, potassium, sodium, and hydrogen ions are closely regulated by multiple mechanisms that keep them relatively constant even when GFR falls to very low levels.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Furosemide is a loop diuretic. It induces natriuresis. Select the correct probable side effect of furosemide due to action on the loop of Henle:", "options": [{"label": "A", "text": "Edema", "correct": false}, {"label": "B", "text": "Hyperkalemia", "correct": false}, {"label": "C", "text": "Hypercalcemia", "correct": false}, {"label": "D", "text": "Decreased ability to concentrate the urine", "correct": true}], "correct_answer": "D. Decreased ability to concentrate the urine", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Decreased ability to concentrate the urine Furosemide mainly works by inhibiting electrolyte reabsorption from the thick ascending limb of the loop of Henle, and enhancing the excretion of water from the body & causing more excretion of sodium, chloride, and potassium in the The diuresis follows natriuresis leading to urine concentrating ability.</p>\n<p><strong>Highyeild:</strong></p><p>The mechanism of action of Furosemide is the inhibition of the sodium-potassium-2 chloride (Na+-K+-2 Cl−) co-transporter (symporter) located in the thick ascending limb of the loop of Henle in the renal tubule. Furosemide is used for edema secondary to various clinical conditions, such as congestive heart failure exacerbation, liver failure, renal failure, and high blood pressure.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Edema- Furosemide does not cause edema; in fact, it is often used to treat severe edema. Option B. Hyperkalemia and C . Hypercalcemia - Furosemide also increases the renal excretion of potassium and calcium and therefore tends to cause hypokalemia and hypocalcemia rather than increasing the plasma concentrations of potassium and calcium.</p>\n<p><strong>Table:</strong></p><p>TYPE ETIOLOGY CLINICAL PRESENTATION EXAMPLES Nephritic syndrome Glomerular inflammation → GBM damage → loss of RBCs into urine →\n dysmorphic RBCs, hematuria Hematuria, RBC casts in urine GFR→ oliguria, azotemia ↑ renin release,\n HTN Proteinuria often in the subnephrotic range (< 3.5 g/ day) but in severe cases may be in nephrotic range Nephrotic syndrome Podocyte damage impaired charge barrier → proteinuria Massive proteinuria (> 3.5 g/day) with edema, hypoalbuminemia →t hepatic lipogenesis → hypercholesterolemia Frothy urine with fatty casts Associated with hypercoagulable state due to antithrombin III\n loss in urine and ↑ risk of infection (loss of IgGs in urine and soft tissue compromise by\n edema) May be 1° (eg, direct podocyte damage) or 2° (podocyte damage from\n systemic process): ■ Focal segmental glomerulosclerosis (1° or 2°) ■ Minimal change disease (1° or 2°) Membranous nephropathy (1° or 2°) ■ Amyloidosis (2°) ■ Diabetic glomerulonephropathy (2°) Nephritic-nephrotic syndrome Severe GBM damage loss of RBCs into urine + impaired charge barrier\n hematuria + proteinuria Nephrotic-range proteinuria (>3.5 g/day) and concomitant features\n of nephritic syndrome Can occur with any form of nephritic syndrome, but is most common\n with: - Diffuse proliferative glomerulonephritis ■ Membranoproliferative glomerulonephritis</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Jitu, A 23-year-old man with gastroenteritis developed severe vomiting with a loss of stomach acids. Metabolic alkalosis is present. Which of the following is most likely to occur?", "options": [{"label": "A", "text": "The plasma bicarbonate concentration will decrease.", "correct": false}, {"label": "B", "text": "H+ will move from the plasma into the cells.", "correct": false}, {"label": "C", "text": "Peripheral chemoreceptors will stimulate pulmonary ventilation.", "correct": false}, {"label": "D", "text": "Renal H+ excretion will decrease.", "correct": true}], "correct_answer": "D. Renal H+ excretion will decrease.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Renal H+ excretion will decrease. The loss of gastric (hydrochloric) acid leads to an increase in plasma bicarbonate concentration and metabolic alkalosis. The increase in the p H will depress peripheral chemoreceptors to slow ventilation and increase the pCO 2 to compensate for the increased bicarbonate.</p>\n<p><strong>Highyeild:</strong></p><p>The increase in pCO 2 will bring the pH nearer to 7.4 and at the same time increase renal H+ secretion. Because there is an increased level of bicarbonate in the glomerular filtrate, there will be an increase in bicarbonate reabsorption. The rate of filtration will exceed the rate of H+ secretion, and there will be a continuous loss of bicarbonate. As the plasma bicarbonate falls, the pH will continue to approach the normal of 7.4 and the ventilatory rate will increase gradually. When all the excess bicarbonate has been excreted, the plasma bicarbonate and pH will have returned to normal with a normal respiratory rate.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest all options are explained above.</p>\n<p><strong>Extraedge:</strong></p><p>Some Important facts:- Carbonic acids are substances whose end products of metabolism are CO2 and water, such as triglycerides and carbohydrates. Noncarbonic or fixed acids are substances whose end products of metabolism are nonvolatile, such as phosphoric acid and sulfuric acid produced from phospholipids and protein breakdown. The rate of bicarbonate reabsorption is dependent on the relative rates of bicarbonate filtration and H+ secretion. The rate of urinary acid excretion is limited by the availability of titratable acids and NH3. Ammoniagenesis is the primary adaptive response of the kidney to chronic acidosis. The isohydric principle states that in a mixed solution, all the acid-base pairs are in equilibrium with each other.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 26 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A 28-year-old woman hits her head on the windshield in an automobile accident. She becomes confused and develops urinary incontinence and a gait disorder. An MRI of the brain reveals enlarged ventricles, suggestive of normal pressure hydrocephalus. Lumbar puncture confirms normal intracranial pressure, and her symptoms are found to improve after the removal of a volume of her cerebrospinal fluid (CSF). Normally, which of the following is true regarding CSF?", "options": [{"label": "A", "text": "It is absorbed by the choroid plexus.", "correct": false}, {"label": "B", "text": "It circulates in the epidural space.", "correct": false}, {"label": "C", "text": "It has a higher protein concentration than plasma.", "correct": false}, {"label": "D", "text": "It has a lower glucose concentration than plasma.", "correct": true}], "correct_answer": "D. It has a lower glucose concentration than plasma.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>It has a lower glucose concentration than plasma. The concentrations of protein and glucose within the cerebrospinal fluid (CSF) are much lower than those of plasma.</p>\n<p><strong>Highyeild:</strong></p><p>Normal Glucose in CSF= 45-80 mg/dL (Plasma: Fasting:70-100; Postprandial:110-146) Proteins: 15 to 45 mg/dL which is 0.015 to 0.045 gm/dL (Plasma: 6-8 gm/dL out of which 3.5 to 5.5 gm/dL is Albumin. Triad of Normal Pressure Hydrocephalus : The clinical features given in this question are the characteristic features of normal pressure hydrocephalus called Hakim’s Triad which are:- Cognitive impairment Ataxia (gait apraxia) Urinary incontinence Changes in the CSF concentrations of these substances are helpful in detecting pathologic processes, such as tumors or infections, in which the blood-brain barrier is disrupted.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. CSF is produced by the choroid plexus and circulates through the ventricles, the cisterns, and the subarachnoid space to be absorbed into the blood by the arachnoid villi. Option: B. Cerebrospinal Fluid (CSF) flows through the four ventricles and then flows between the meninges in an area called the subarachnoid space. Option: C. The protein content of CSF is lesser than the plasma as already explained.</p>\n<p><strong>Extraedge:</strong></p><p>Some important changes in CSF in infections Normal Bacterial Tubercular Viral Opening Pressure 50-180mmHg >180mmHg 150-280mmHg (increased and but the increase in ICP is gradual and not very high) 100- 350mmHg Physical features Clear Turbid Turbid and forms cobweb on standing Q (due to high levels of protein >150mg/dL.) Clear Glucose(mg/dL) 40-85 <40 20-40 Normal Protein(mg/dL) 15-45 >45mg/dL 150-200 20-80 Number of WBCs/mm 3 <5 10-10,000 10-500 25-500 Predominant WBCs 60-70% lymphocytes; =30% Monocytes /macrophages PMNs>80% Lymphocytes predominant Lymphocytes predominant CSF/serum glucose <0.4</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 72-year-old male is evaluated by a physiatrist after a stroke. The patient is observed to suffer from dysmetria, ataxia, and intentional tremor. These neurological signs are most likely related to a lesion within which of the following regions of the brain?", "options": [{"label": "A", "text": "Cerebellum", "correct": true}, {"label": "B", "text": "Medulla", "correct": false}, {"label": "C", "text": "Cortical motor strip", "correct": false}, {"label": "D", "text": "Basal ganglia", "correct": false}], "correct_answer": "A. Cerebellum", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Cerebellum Clinical Features in the given questions - Ataxia, Dysmetria, and intentional tremors are characteristic features of cerebellar dysfunction.</p>\n<p><strong>Highyeild:</strong></p><p>Damage to the cerebellum leads to several characteristic abnormalities including: Ataxia- The marked ataxia in cerebellar disorders is characterized as incoordination due to errors in the rate, range, force, and direction of movement. This leads to abnormal movements, particularly in skilled movements. This, therefore, manifests as: unsteady gait which is called ‘wide based’ or ‘drunken gait’ Slurred speech called ‘scanning speech’ Nystagmus Disequilibrium Intentional tremor- Abnormalities of voluntary movements occur such as overshooting while reaching out for an object. This dysmetria promptly initiates a gross corrective action, but the correction overshoots to the other side, and the finger oscillates back and forth. This oscillation is called an intention tremor. Dysdiadochokinesia: Dysmetria leads to an inability to perform rapid movements called dysdiadochokinesia which results from the inability to promptly stop movement properly (rebound phenomenon). Decomposition of movement: These patients dissect complex movements and carry them out one joint at a time which is known as decomposition of movement. Hypotonia- Decreased tone of the musculature is due to loss of the deep cerebellar nuclei, particularly of the dentate and interposed nuclei, causing the decreased tone of the peripheral body musculature. Cerebellar infarcts and hemorrhages are relatively uncommon, accounting for less than 10% of all strokes. Hereditary and alcoholism are more common causes of isolated cerebellar dysfunction.</p>\n<p><strong>Random:</strong></p><p>Explanation for incorrect Options:- Option: B. Medulla: Medullary syndromes are characterized by a wider variety of symptoms which include XII nerve palsy, hemiplegia, dysphagia, absence of gag reflex, and Horner’s syndrome depending on the area of medulla involved. However, cerebellar symptoms can occur in Lateral Medullary syndrome where inferior cerebellar peduncles are involved. Since this question gives the history of ONLY cerebellar symptoms: cerebellum > Medulla. Option: C. Cortical motor strip: No hemiparesis or defect of higher CNS functions (speech, comprehension, personality, etc.) Option: D. Basal ganglia: Rigidity and resting tremors (not intention tremors unlike those described in the question) are characteristic features which are not given in the question.</p>\n<p><strong>Extraedge:</strong></p><p>Causes of cerebellar dysfunction include: Hereditary and degenerative diseases, Friedreich ataxia, and Machado-Joseph disease. Acquired metabolic and nutritional disorders: This includes deficiency of Thiamine due to chronic alcohol abuse- Leads to degeneration of the spinocerebellum. Infections (SSPE, Chicken Pox, Measles, CMV) Vascular diseases Hemorrhagic stroke and Ischemic stroke Tumors Demyelinating diseases Basilar migraine Iatrogenic (drug) ataxia</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Due to cranial trauma, the patient developed the symptoms: intention tremor, dysmetria, adiadochokinesia, and dysarthria. What structure of the brain is injured?", "options": [{"label": "A", "text": "Motor cortex", "correct": false}, {"label": "B", "text": "Pale sphere", "correct": false}, {"label": "C", "text": "Black substance", "correct": false}, {"label": "D", "text": "Cerebellum", "correct": true}], "correct_answer": "D. Cerebellum", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Cerebellum The cerebellum smooths muscle contractions, maintains muscle tone and posture, coordinates the motions of different joints with each other (such as the shoulder and elbow joints in pitching a baseball), coordinates eye and body movements, and aids in learning motor skills.</p>\n<p><strong>Highyeild:</strong></p><p>It receives signals from the upper motor neurons about intended movements and gets feedback about the actual performance from proprioceptors in the muscles and joints, via the spinocerebellar tracts of the spinal cord. The main symptoms of lesions in the cerebellum are intention tremor, dysmetria (past pointing), dysdiadochokinesia (adiadochokinesia), scanning dysarthria, gaze dysfunction (nystagmus), hypotonia of muscles, difficulty maintaining posture, gait, or balance (an ataxic gait).</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. When an injury damages the primary motor cortex, the person will typically experience a loss of coordination and poor dexterity. Option: B. The globus pallidus itself is a pale-appearing spherical area in the brain. Option: C. The substantia nigra gets its name from Latin and means \"black substance.”</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A patient complains of rapid fatigability. Objectively: he staggers and overbalances in the upright position with closed eyes. Skeleton muscular tonus is decreased. What brain structure is most likely to be damaged?", "options": [{"label": "A", "text": "Precentral gyrus of cerebrum cortex", "correct": false}, {"label": "B", "text": "Basal Ganglions", "correct": false}, {"label": "C", "text": "Cerebellum", "correct": true}, {"label": "D", "text": "Thalamus", "correct": false}], "correct_answer": "C. Cerebellum", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Cerebellum The cerebellum smooths muscle contractions, maintains muscle tone and posture, coordinates the motions of different joints with each other (such as the shoulder and elbow joints in pitching a baseball), coordinates eye and body movements, and aids in learning motor skills.</p>\n<p><strong>Highyeild:</strong></p><p>It receives signals from the upper motor neurons about intended movements and gets feedback about the actual performance from proprioceptors in the muscles and joints, via the spinocerebellar tracts of the spinal cord. The main symptoms of lesions in the cerebellum are intention tremor, dysmetria (past pointing), dysdiadochokinesia (adiadochokinesia), scanning dysarthria, gaze dysfunction (nystagmus), hypotonia of muscles, difficulty maintaining posture, gait, or balance (an ataxic gait).</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Lesions of the precentral gyrus result in paralysis of the contralateral side of the body (facial palsy, arm-/leg monoparesis, hemiparesis). Option: B. Damage to the basal ganglia cells may cause problems controlling speech, movement, and posture. Option: D. Damage to the thalamus can result in unconsciousness and even coma. Sleep disorders, such as insomnia and fatal familial insomnia (inability to sleep, leading to death), and Thalamic aphasia (jumbled words, meaningless speech).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A patient underwent extraction of a part of a CNS structure by medical indications. As a result of the extraction, the patient developed atony, astasia, intention tremor, ataxy, and adiadochokinesia. Which part of the CNS structure had been extracted?", "options": [{"label": "A", "text": "Basal ganglions", "correct": false}, {"label": "B", "text": "Cerebellum", "correct": true}, {"label": "C", "text": "Amygdaloid corpus", "correct": false}, {"label": "D", "text": "Hippocamp", "correct": false}], "correct_answer": "B. Cerebellum", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Cerebellum The cerebellum smooths muscle contractions, maintains muscle tone and posture, coordinates the motions of different joints with each other (such as the shoulder and elbow joints in pitching a baseball), coordinates eye and body movements, and aids in learning motor skills.</p>\n<p><strong>Highyeild:</strong></p><p>It receives signals from the upper motor neurons about intended movements and gets feedback about the actual performance from proprioceptors in the muscles and joints, via the spinocerebellar tracts of the spinal cord. The main symptoms of lesions in the cerebellum are intention tremor, dysmetria (past pointing), dysdiadochokinesia (adiadochokinesia), scanning dysarthria, gaze dysfunction (nystagmus), hypotonia of muscles, difficulty maintaining posture, gait, or balance (an ataxic gait).</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Damage to the basal ganglia cells may cause problems controlling speech, movement, and posture. Option: C. When the amygdala sustains damage, it can cause difficulty with memory processing, emotional reactions, and decision-making. Option: D. Damage to the hippocampus can cause a condition called amnesia that prevents people from forming new memories and remembering past experiences.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 50-year-old patient was injured on the occipital region of the head. The closed skull trauma was diagnosed. She was taken to the hospital. The medical examination on deregulation of walking and balance, trembling of arms. What part of the brain was injured?", "options": [{"label": "A", "text": "The midbrain", "correct": false}, {"label": "B", "text": "The hippocampal", "correct": false}, {"label": "C", "text": "The medulla oblongata", "correct": false}, {"label": "D", "text": "The cerebellum", "correct": true}], "correct_answer": "D. The cerebellum", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The cerebellum The cerebellum smooths muscle contractions, maintains muscle tone and posture, coordinates the motions of different joints with each other (such as the shoulder and elbow joints in pitching a baseball), coordinates eye and body movements, and aids in learning motor skills.</p>\n<p><strong>Highyeild:</strong></p><p>It receives signals from the upper motor neurons about intended movements and gets feedback about the actual performance from proprioceptors in the muscles and joints, via the spinocerebellar tracts of the spinal cord. The main symptoms of lesions in the cerebellum are intention tremor, dysmetria (past pointing), dysdiadochokinesia (adiadochokinesia), scanning dysarthria, gaze dysfunction (nystagmus), hypotonia of muscles, difficulty maintaining posture, gait, or balance (an ataxic gait).</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A . Damage to the midbrain can result in a wide variety of movement disorders, difficulty with vision and hearing, and trouble with memory. Because the midbrain houses the hypothalamus, it also plays a major role in automatic body functions. Option: B. Damage to the hippocampus can cause a condition called amnesia that prevents people from forming new memories and remembering past experiences. Option: C. Medulla oblongata becomes damaged, which can lead to respiratory failure, paralysis, or loss of sensation.</p>\n<p><strong>Extraedge:</strong></p><p>Modulates movement; aids in coordination and balance Ipsilateral (unconscious) proprioceptive information via the inferior cerebellar peduncle from the spinal cord. Deep nuclei (lateral → medial)-dentate, emboliform, globose, fastigial (don't eat greasy foods) Lateral lesions-affect voluntary movement of extremities (lateral structures); when injured, the propensity to fall toward the injured (ipsilateral) side. Medial lesions (g., vermis, fastigial nuclei, flocculonodular lobe)-truncal ataxia (wide-based cerebellar gait), nystagmus, head tilting. Generally result in bilateral motor deficits affecting axial and proximal limb musculature ( medial structures). Tests: rapid alternating movements (pronation/ supination), finger-to-nose, heel-to-shin, gait, look for intention tremor.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 41-year-old man is seen by his physician complaining of always feeling tired and having vivid dreams when he is sleeping. He is referred to the hospital’s sleep center for evaluation. He is diagnosed with narcolepsy based on his clinical history and the presence of rapid eye movements (REM) as soon as he falls asleep. Which of the following signs will be observed when the patient is exhibiting REM sleep?", "options": [{"label": "A", "text": "Hyperventilation", "correct": false}, {"label": "B", "text": "Periods of loss of skeletal muscle tone", "correct": true}, {"label": "C", "text": "Slow but steady heart rate", "correct": false}, {"label": "D", "text": "High amplitude EEG wave", "correct": false}], "correct_answer": "B. Periods of loss of skeletal muscle tone", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Periods of loss of skeletal muscle tone In Narcolepsy, a person may pass directly from the waking state to REM sleep.</p>\n<p><strong>Highyeild:</strong></p><p>The affected individual experiences a sudden loss of voluntary muscle tone (cataplexy), an eventual irresistible urge to sleep during the daytime, and possibly brief episodes of total paralysis at the beginning or end of sleep.</p>\n<p><strong>Random:</strong></p><p>Explanation for incorrect Options:- Option: A. Hyperventilation- In NREM sleep, the respiratory rate primarily shows a slight decrement. In REM sleep, the respiratory rate, as well as tidal volume, becomes irregular but an overall decrease occurs in minute ventilation volume because both hypoxic and hypercapnic ventilatory responses decrease due to diminished sensitivity of chemoreceptors during sleep. Option: C. Slow but steady heart rate- heart rate is irregular during REM sleep due to intermittent rise in sympathetic activity. Option: D. High amplitude EEG waves- High amplitude slow waves occur in NREM sleep and rapid low amplitude waves occur in REM sleep.</p>\n<p><strong>Extraedge:</strong></p><p>NORMAL SLEEP In a normal sleep cycle, a person passes through the four stages of slow wave sleep (NREM) before entering REM sleep- In a typical night of sleep, a young adult first enters non-REM sleep, passes through stages 1 and 2, and spends 70–100 min in stages 3 and 4. Sleep then lightens, and a REM period follows. This cycle is repeated at intervals of about 90 min throughout the night. NREM sleep is characterized by decreases in muscle tone, heart rate, breathing, blood pressure, and metabolic rate. REM sleep is characterized by irregular heartbeats and respiration and by periods of atonia (loss of muscle tone). Brain activity during REM sleep is high and brain metabolism increases by more than 20% (Hence, called paradoxical sleep/desynchronized sleep). In addition, REM sleep, as the name implies, is characterized by rapid, rolling eye movements. Penile erection also occurs during REM sleep, a fact that is clinically important in determining whether a complaint of impotence has a physical or psychological basis. Physical causes mean that there is an underlying pathology (g., vascular, endocrine, post-trauma, iatrogenic damage) hence erection does not happen at all whereas, in psychological causes, REM erection does occur. REM is the active state of sleep in which dreaming occurs. (actually, dreaming occurs in both REM and NREM sleep but the dreams in REM sleep are more emotional and remembered whereas dreams in NREM sleep are not remembered). Hypoventilation is characteristic of both REM and NREM sleep because sleep depresses the central chemoreceptors (rising arterial and falling arterial stimulate ventilation. Hypoxia acts through peripheral chemoreceptors in the carotid bodies, whereas acts mainly through the central chemoreceptor in the medulla and also to an extent through the carotid body chemoreceptor).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 3-month-old baby is brought to her pediatrician for a check-up. Stroking the plantar surface of the foot produces a reflex extension of the large toe rather than the expected flexion. The Babinski sign elicited by the physician indicates damage to which of the following?", "options": [{"label": "A", "text": "Spinal cord", "correct": false}, {"label": "B", "text": "Brainstem", "correct": false}, {"label": "C", "text": "Cerebellum", "correct": false}, {"label": "D", "text": "Pyramidal tracts", "correct": true}], "correct_answer": "D. Pyramidal tracts", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Pyramidal tracts Babinski response in a child less than 2 years is not abnormal but please note that in MCQs you have to choose the best possible answer out of the options given. Upper motor neurons typically refer to corticospinal tract neurons that innervate spinal motor neurons, but they can also include brainstem neurons that control spinal motor neurons. Damage to these neurons initially causes muscles to become weak and flaccid but eventually leads to spasticity, hypertonia (increased resistance to passive movement), hyperactive stretch reflexes, and abnormal extensor plantar response (positive Babinski sign). The Babinski sign is dorsiflexion of the great toe and fanning of the other toes when the lateral aspect of the sole of the foot is scratched.</p>\n<p><strong>Highyeild:</strong></p><p>In adults, the normal response to this stimulation is plantar flexion in all the toes. The Babinski sign is of value in the localization of disease processes, but its physiologic significance is unknown. In infants whose corticospinal tracts are not well developed, dorsiflexion of the great toe and fanning of the other toes is the natural response. In lesions of the precentral gyrus representing the leg region, the sign of Babinski, extensor response to a plantar stimulus is observed. The limb is kept in an extended position and some voluntary movement reappears. The patients are able to stand and walk, although their steps are small and hampered by the existing spasticity. In the case of damage to the precentral gyrus area representing the upper limb, the recovery of voluntary movement is often insufficient to allow the patient to grasp objects and use them properly. The Babinski sign, illustrated, is diagnostic of a lesion of the corticospinal tract. When the sole of the foot is stroked firmly along the path indicated, the normal response is flexion of the foot and toes. The Babinski sign is an extension of the big toe and fanning of the others.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest Options are inappropriate because characteristic Signs of pyramidal tract dysfunction include spasticity, weakness, slowing of rapid alternating movements, hyperreflexia, and a Babinski sign.</p>\n<p><strong>Extraedge:</strong></p><p>DIFFERENCES BETWEEN UPPER AND LOWER MOTOR NEURON INVOLVEMENT CLINICAL FEATURE UPPER MOTOR NEURON LOWER MOTOR NEURON Inspection Normal Wasted; Fasciculations(+) Q Tone Increased with Clonus Hypotonia; May be normal Pattern of weakness Preferentially affects extensors in arms, flexors in leg. Hemiparesis, paraparesis or tetraparesis Typically focal, in distribution of nerve root or peripheral nerve, with associated sensory changes Deep tendon reflexes Exaggerated Decreased/absent Plantar response Babinski sign (+) Absent</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 41-year-old man complains to his physician about jet lag whenever he flies long distances to meetings. Melatonin is prescribed as a way to reset his circadian rhythm. The circadian rhythm is controlled by which of the following?", "options": [{"label": "A", "text": "Paraventricular nucleus", "correct": false}, {"label": "B", "text": "Ventromedial nucleus", "correct": false}, {"label": "C", "text": "Arcuate nucleus", "correct": false}, {"label": "D", "text": "Suprachiasmatic nucleus", "correct": true}], "correct_answer": "D. Suprachiasmatic nucleus", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Suprachiasmatic nucleus A variety of physiological functions, such as alertness (the sleep-wake cycle), body temperature, and secretion of hormones, exhibit cyclic activity that varies over a 24-h period of time called circadian rhythms and are controlled by the suprachiasmatic nucleus of the hypothalamus.</p>\n<p><strong>Highyeild:</strong></p><p>Control of circadian rhythm: SCN neurons are located just above the optic chiasm in the hypothalamus, from which they receive visual input to synchronize them with the external world, and they have outputs to transmit that signal to the rest of the body. Bilateral destruction of the SCN results in a loss of most endogenous circadian rhythms including wake-sleep behavior and rhythms in endocrine and metabolic systems.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. The paraventricular nucleus secretes oxytocin and vasopressin, Option: B. The ventromedial and lateral nuclei control food intake. Option: D. The arcuate nucleus secretes gonadotropin-releasing hormone.</p>\n<p><strong>Extraedge:</strong></p><p>Sleep Physiology Sleep cycle is regulated by the circadian rhythm, which is driven by the suprachiasmatic nucleus (SCN) of the hypothalamus. The circadian rhythm controls the nocturnal release of ACTH, prolactin, melatonin, and norepinephrine: SCN → norepinephrine release → pineal gland → ↑ melatonin. SCN is regulated by the environment (g., light). Two stages: rapid-eye movement (REM) and non-REM. Alcohol, benzodiazepines, and barbiturates are associated with ↓ REM sleep and N3 sleep; norepinephrine also ↓ REM sleep. Benzodiazepines are useful for night terrors and sleepwalking by 4 N3 and REM sleep.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 24-year-old medical student develops apprehension, restlessness, tachycardia, and tachypnea as he enters the testing center for his initial licensure examination. Activation of which of the following receptors would be expected to decrease his anxiety?", "options": [{"label": "A", "text": "Neuropeptide Y", "correct": false}, {"label": "B", "text": "Glutamate", "correct": false}, {"label": "C", "text": "GABAa", "correct": true}, {"label": "D", "text": "Histamine", "correct": false}], "correct_answer": "C. GABAa", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>GABAa Decreased GABA activity may contribute to anxiety and mood disorders. Schizophrenia. Autism spectrum disorder.</p>\n<p><strong>Highyeild:</strong></p><p>γ-Aminobutyric acid (GABA) is the major inhibitory mediator in the brain. The increase in Cl– conductance produced by GABAa receptors is potentiated by the anxiolytic drug, diazepam, and other benzodiazepines.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Neuropeptide Y is an excitatory neurotransmitter that has a stimulatory effect on food intake . Option: B. Glutamate is the major excitatory transmitter in the brain. Option: D. Central nervous system actions of histamine have been implicated in arousal, sexual behavior, drinking, pain thresholds, and the sensation of itch .</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The daughter of an 85-year-old man brings him to his doctor’s appointment. She reports that he has memory loss, is often confused, and has been having increasing difficulty with routine activities that he used to do on his own, such as paying bills and going grocery shopping. She wonders if this is just old age or a more serious problem. Which of the following would provide the definitive diagnosis of Alzheimer’s Disease?", "options": [{"label": "A", "text": "Nonspecific slowing of the EEG", "correct": false}, {"label": "B", "text": "Presence of an apolipoprotein ε4 (Apo ε4) allele on chromosome 19", "correct": false}, {"label": "C", "text": "Improved symptoms with cholinesterase inhibitors", "correct": false}, {"label": "D", "text": "Microscopic pathological findings on autopsy, including neuritic plaques containing A-beta (Ab) amyloid bodies and silver-staining neurofibrillary tangles in neuronal cytoplasm", "correct": true}], "correct_answer": "D. Microscopic pathological findings on autopsy, including neuritic plaques containing A-beta (Ab) amyloid bodies and silver-staining neurofibrillary tangles in neuronal cytoplasm", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Microscopic pathological findings on autopsy, including neuritic plaques containing A-beta (Ab) amyloid bodies and silver-staining neurofibrillary tangles in neuronal cytoplasm Amyloid bodies and silver-staining neurofibrillary tangles in neuronal cytoplasm. A clinical diagnosis of AD is reached after the careful evaluation is confirmed at autopsy .</p>\n<p><strong>Highyeild:</strong></p><p>Microscopically, affected brain regions demonstrate inflammation, granulovacuolar degeneration, Hirano bodies, as well as the two classical inclusions: neurofibrillary tangles (NFTs) and amyloid plaques. The characteristic microscopic findings of Alzheimer's disease include neuritic plaques (\"senile plaques\") which are extracellular deposits of the amyloid beta-protein (Aß).</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- (although not diagnostic features; are related to Alzheimer’s disease) Option: A. Non-specific slowing of EEG: Not a diagnostic feature of any disease. Option: B. Presence of an apolipoprotein ε4 (Apo ε4) allele on chromosome 19: The presence of an apolipoprotein ε4 (Apo ε4) allele on chromosome 19, especially in the homozygous 4/4 state, is an important risk factor for Alzheimer’s disease (AD). Option: C. Improved symptoms with cholinesterase inhibitors: cholinesterase inhibitors may be used to improve memory in AD by increasing available levels of acetylcholine.</p>\n<p><strong>Extraedge:</strong></p><p>Slowly progressive decline in memory and orientation, normal results on laboratory tests, and an MRI or CT scan showing only distributed or posteriorly predominant cortical and hippocampal atrophy are highly suggestive of AD. However, the definitive diagnosis of AD is only obtained by tissue examination on autopsy, with the presence of amyloid plaques and neurofibrillary tangles in the neurons of the cerebral cortex, primarily in the temporal lobe, hippocampus, and nucleus basalis of Meynert (lateral septum). Short of an autopsy, diagnosis is mainly clinical-A clinical diagnosis must rule out other causes of dementia, including other major common causes such as vascular disease, Parkinson’s disease, alcohol dependence, alcoholism, or other drug/medication intoxication.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 35-year-old female was watching TV for long hours with her hands under her head. She complains of a tingling sensation over the arm and weakness. Which type of nerve fiber is most likely to be affected?", "options": [{"label": "A", "text": "A", "correct": true}, {"label": "B", "text": "B", "correct": false}, {"label": "C", "text": "C", "correct": false}, {"label": "D", "text": "Sympathetic", "correct": false}], "correct_answer": "A. A", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>A Susceptibility of pressure on Nerve fibers: A>B>C. Since Large diameter axons (A fibers) such as motor neurons, proprioception, touch, and pressure fibers are lost first and pain (C fibers) sensations remain intact. Patterns of this type are sometimes seen in individuals who sleep with their arms under their heads for long periods, causing compression of the nerves in the arms. Susceptibility To: Most Susceptible Intermediate Least Susceptible Hypoxia B A C Pressure A B C Local anesthetics C B A</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Susceptibility of pressure on Nerve fibers : A>B>C. So the correct answer is Option A. A.</p>\n<p><strong>Extraedge:</strong></p><p>The above-mentioned symptoms caused by extended periods of compression are seen in association with deep sleep with arms under their heads usually seen in patients with Alcohol intoxication (Saturday night palsy). Susceptibility of nerve fibers to conduction blocks produced by various agents: Hypoxia : B>A>C Local anesthetics: C>B>A</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 27-year-old patient with a chief complaint of mild vertigo of 3 months duration is seen by a neurologist. Examination reveals a positional (horizontal and vertical) nystagmus that is bidirectional. The patient reports the absence of tinnitus. Which of the following is the most likely etiology of vertigo?", "options": [{"label": "A", "text": "Labyrinthitis", "correct": false}, {"label": "B", "text": "Meniere’s syndrome", "correct": false}, {"label": "C", "text": "Lesion of the flocculonodular lobe of the cerebellum", "correct": true}, {"label": "D", "text": "Lesion of the spinocerebellum", "correct": false}], "correct_answer": "C. Lesion of the flocculonodular lobe of the cerebellum", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Lesion of the flocculonodular lobe of the cerebellum The major dysfunction seen after damage to the vestibulocerebellum (Flocculonodular lobe) is ataxia, disequilibrium, and nystagmus.</p>\n<p><strong>Highyeild:</strong></p><p>The vestibulocerebellum functions to maintain the stability of the head on the body. It acts on the neck muscles via the lateral VST, to maintain a steady head position despite movements of the body, and thereby maintains visual fixation on distant objects, such as when a person is running or in a moving vehicle.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Labyrinthitis: no history of nausea; vomiting Option: B. Meniere’s disease: No history of ear fullness for tinnitus Option: D. Lesion of spinocerebellum: Damage to the vermis and fastigial nucleus (part of the spinocerebellum) leads to scanning speech and disturbances in the control of axial and trunk muscles during attempted antigravity postures . Degeneration of this portion of the cerebellum can result from thiamine deficiency in alcoholics or malnourished individuals.</p>\n<p><strong>Extraedge:</strong></p><p>The major dysfunction seen after damage to the cerebrocerebellum is a delay in initiating movements and decomposition of movement. Central vertigo Peripheral vertigo Due to brainstem or cerebellum dysfunction Due to involvement of organs of balance present in inner ear Lesions allow the eyes to drift back in towards primary position, producing nystagmus with fast component beats in the direction of gaze (gaze-evoked nystagmus). This is the most common type of central nystagmus; it is most commonly bidirectiona l and not usually accompanied by vertigo Unidirectional horizontal nystagmus (horizontal canal is affected) Vertical and torsional components (other parts are affected) Chronic Acute and Intermittent (due to CNS habituation) tinnitus or deafness is absent Tinnitus or deafness maybe present</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The application of norepinephrine (NE) to the ENS suppresses cholinergically mediated EPSPs but has no effect on depolarizing responses to applied acetylcholine (ACh). This finding is best interpreted as:", "options": [{"label": "A", "text": "Postsynaptic excitation", "correct": false}, {"label": "B", "text": "Slow synaptic inhibition", "correct": false}, {"label": "C", "text": "Presynaptic inhibition", "correct": true}, {"label": "D", "text": "Synaptic facilitation", "correct": false}], "correct_answer": "C. Presynaptic inhibition", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Presynaptic inhibition Presynaptic inhibition is caused by the release of an inhibitory substance into the outsides of the presynaptic nerve fibrils before their own endings terminate on the postsynaptic neuron.</p>\n<p><strong>Highyeild:</strong></p><p>This release has the specific effect of opening anion channels, allowing large numbers of chloride ions to diffuse into the terminal fibril. The negative charges of these ions inhibit synaptic transmission because they cancel much of the excitatory effect of the positively charged sodium ions that also enter the terminal fibrils when an action potential arrives. A large share of the EPSP is lost before it reaches the soma. The reason a large share is lost is that the dendrites are long, and their membranes are thin and at least partially permeable to potassium and chloride ions, making them leaky to an electric current. Therefore, before the excitatory potentials can reach the soma, a large share of the potential is lost by leakage through the membrane.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. The postsynaptic element is usually the membrane of soma or dendrite of postsynaptic neurons. Option: B. The second type of communication between nerve cells, slow synaptic transmission, occurs over periods of hundreds of milliseconds to minutes and is enormously more complex than fast synaptic transmission. Option: D. Synaptic facilitation is a form of short-term plasticity that enhances synaptic transmission for less than a second. Facilitation is a ubiquitous phenomenon thought to play critical roles in information transfer and neural processing.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 59-year-old woman is admitted to the hospital because of agitation and aggression. Three years prior to admission her irregular, flinging movements had become so severe that she could not walk or assist in her own care. She is diagnosed with Huntington’s chorea, which is a hereditary disease affecting neurons within which of the following?", "options": [{"label": "A", "text": "Anterior cerebellum", "correct": false}, {"label": "B", "text": "Subthalamus", "correct": false}, {"label": "C", "text": "Substantia nigra", "correct": false}, {"label": "D", "text": "Caudate nucleus", "correct": true}], "correct_answer": "D. Caudate nucleus", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Caudate nucleus Huntington’s chorea is an inherited genetic defect leading to the degeneration of neurons with the caudate nucleus . It is a progressive disease characterized by uncontrolled movements, irritability, depression, and ultimately dementia and death.</p>\n<p><strong>Highyeild:</strong></p><p>OTHER SIGNS USEFUL FOR LOCALISING: Putamen: Dystonia Subthalamic nucleus: Ballism Substantia nigra: Resting tremors; Parkinsonism Damaging the cerebellum causes uncoordinated movements (dysmetria, ataxia, intention tremor, overshooting/post pointing; slowness of movement Chorea: Caudate nucleus (Caudate nucleus atrophy occurs in Huntington’s disease) Athetosis: Globus pallidus</p>\n<p><strong>Extraedge:</strong></p><p>Huntington's Disease (HD) is a devastating neurodegenerative disease caused by an expanded trinucleotide CAG repeat in the HTT gene. The striatum, comprising the caudate nucleus (CAU) and putamen, is the primarily affected brain region in HD.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 55-year-old man reports that he has lost the sensation of pain throughout one side of the body and the opposite side of the face. Which disorder is he suffering from most likely?", "options": [{"label": "A", "text": "Brown –Sequard syndrome", "correct": false}, {"label": "B", "text": "Thalamic pain syndrome", "correct": false}, {"label": "C", "text": "Herpes zoster", "correct": false}, {"label": "D", "text": "Lateral medullary syndrome", "correct": true}], "correct_answer": "D. Lateral medullary syndrome", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Lateral medullary syndrome The lateral medullary syndrome exhibits one of the most characteristic patterns of sensory loss in clinical neurology; pain sensation is lost over a side of the body from feet to neck and on the opposite side of the face. The side of facial pain loss indicates the side of the lesion.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Paralysis or hemi paralysis is caused due to damage to one half of the spinal cord . Option: B. Form of neuropathic pain can be any combination of itching, burning, or searing experienced spontaneously. Option: C. Shingles cause a painful rash that may appear as a stripe of blisters on the torso . Pain can persist even after the rash is gone.</p>\n<p><strong>Extraedge:</strong></p><p>Wallenberg syndrome, also known as “lateral medullary syndrome” or “posterior inferior cerebellar artery (PICA) syndrome”, is the most prevalent posterior ischemic stroke syndrome. This neurological condition is characterized by lateral medullary infarction resulting from occlusion of the posterior inferior cerebellar artery (PICA) or the vertebral artery. Typically, this is due to an atherothrombotic occlusion, which is when a blood clot blocks one of the arteries that supply the medulla. The most common cause of Wallenberg syndrome is an ischemic stroke of the brain stem, oftentimes a result of a thrombus or embolism. Other less common causes include mechanical trauma to the vertebral artery in the neck, vertebral arteritis (inflammation of the wall of the artery), aneurysm of the vertebral artery, arteriovenous malformations (AVMs), head injury, and multiple sclerosis (MS).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A college boy met with an accident while returning from college fest. An ambulance carried him to the hospital. He became conscious after some time but his eyes were showing jerky movements. And when he was asked to walk he was walking like an alcoholic. On asking, he denies any alcohol taken. MRI was done and it showed cerebellar hemorrhage. Which part of the cerebellum is likely to be hurt?", "options": [{"label": "A", "text": "Anterior lobe", "correct": false}, {"label": "B", "text": "Dentate nucleus", "correct": false}, {"label": "C", "text": "Posterior lobe", "correct": false}, {"label": "D", "text": "Flocculonodular lobe", "correct": true}], "correct_answer": "D. Flocculonodular lobe", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Flocculonodular lobe Hemorrhage to the flocculonodular lobe, also known as the Vestibulocerebellum, can lead to loss of oculomotor control. Loss of integration of vestibular information for eye and head control and loss of equilibrium balance and muscle tone . That’s why the patient has jerky eyes and a disoriented gait. So, option D is true.</p>\n<p><strong>Random:</strong></p><p>Explanation for incorrect Options:- Option: A. The anterior lobe is responsible for unconscious proprioception. So incorrect option. Option: B. Dentate nucleus is responsible for the planning, initiation, and Control of voluntary movement. The patient wasn’t having any such issues so it is an incorrect option. Option: C. posterior lobe plays an important role in fine motor coordination, especially, in the inhibition of involuntary movement.</p>\n<p><strong>Extraedge:</strong></p><p>Schematic representation of the major anatomical subdivisions of the cerebellum:-</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following clearly states the role of the cerebellum in motor performance ?", "options": [{"label": "A", "text": "Planning and programming of movement", "correct": false}, {"label": "B", "text": "Convert abstract thought into voluntary action", "correct": false}, {"label": "C", "text": "Initiation of skilled voluntary action", "correct": false}, {"label": "D", "text": "Smoothes and coordinates ongoing movements", "correct": true}], "correct_answer": "D. Smoothes and coordinates ongoing movements", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Smoothes and coordinates ongoing movements Part of the cerebellar motor control system provides smooth, coordinated movements of the agonist and antagonist muscles of the distal limbs for performing acute purposeful patterned movements.</p>\n<p><strong>Highyeild:</strong></p><p>The basal ganglia help plan and control complex patterns of muscle movement. They control the relative intensities of the separate movements, directions of movements, and sequencing of multiple successive and parallel movements to achieve specific complicated motor goals.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest options are not correct because the cerebellar motor control system provides smooth, coordinated movements of the agonist and antagonist muscles of the distal limbs for performing acute purposeful patterned movements.</p>\n<p><strong>Extraedge:</strong></p><p>Damage to the cerebellum leads to several characteristic abnormalities including: Ataxia- The marked ataxia in cerebellar disorders are characterized as incoordination due to errors in the rate, range, force, and direction of movement. This leads to abnormal movements, particularly in skilled movements. This, therefore, manifests as unsteady gait which is called ‘wide based’ or ‘drunken gait’ Slurred speech called ‘scanning speech’ Nystagmus Disequilibrium Intention tremor- Abnormalities of voluntary movements occur such as overshooting while reaching out for an object. This dysmetria promptly initiates a gross corrective action, but the correction overshoots to the other side, and the finger oscillates back and forth. This oscillation is called an intention tremor. Dysdiadochokinesia: Dysmetria leads to an inability to perform rapid movements called dysdiadochokinesia which results from the inability to promptly stop movement properly (rebound phenomenon). Decomposition of movement: These patients dissect complex movements and carry them out one joint at a time which is known as decomposition of movement. Hypotonia- Decreased tone of the musculature is due to loss of the deep cerebellar nuclei, particularly of the dentate and interposed nuclei, causes decreased tone of the peripheral body musculature Hereditary and alcoholism are more common causes of isolated cerebellar dysfunction. Causes of cerebellar dysfunction include: Hereditary and degenerative diseases Friedreich ataxia and Machado-Joseph disease. Acquired metabolic and nutritional disorders: This includes deficiency of Thiamine due to chronic alcohol abuse- Leads to degeneration of the spinocerebellum. Infections (SSPE, Chicken Pox, Measles, CMV) Vascular diseases Hemorrhagic stroke and Ischemic stroke Tumors Demyelinating diseases Basilar migraine Iatrogenic (drug) ataxia</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Lesion of which of the following structures leads to Klüver-Bucy syndrome?", "options": [{"label": "A", "text": "Amygdala", "correct": true}, {"label": "B", "text": "Hippocampus", "correct": false}, {"label": "C", "text": "Hypothalamus", "correct": false}, {"label": "D", "text": "Temporal lobes", "correct": false}], "correct_answer": "A. Amygdala", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Amygdala Effects of Bilateral Ablation of the Amygdala—The Klüver-Bucy Syndrome.</p>\n<p><strong>Highyeild:</strong></p><p>Kluver-Bucy syndrome (KBS) is a neuropsychiatric disorder due to lesions affecting bilateral temporal lobes, especially the hippocampus, and Clinical Features Hyperorality (A tendency or compulsion to examine objects by mouth) Hypermetamorphosis (Excessive attentiveness to visual stimuli with a tendency to touch every such stimulus regardless of its history or reward value) Hypersexuality Bulimia Placidity Visual agnosia Amnesia</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Klüver-Bucy syndrome is the result of damage to the Amygdala temporal lobes of the brain. So the correct option is D only.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The therapeutic effect of L-dopa in patients with Parkinson’s disease eventually wears off because:", "options": [{"label": "A", "text": "Antibodies to dopamine receptors develop.", "correct": false}, {"label": "B", "text": "Inhibitory pathways grow into the basal ganglia from the frontal lobe.", "correct": false}, {"label": "C", "text": "There is an increase in circulating a-synuclein.", "correct": false}, {"label": "D", "text": "The dopaminergic neurons in the substantia nigra continue to degenerate.", "correct": true}], "correct_answer": "D. The dopaminergic neurons in the substantia nigra continue to degenerate.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The dopaminergic neurons in the substantia nigra continue to degenerate. Parkinson's disease is a progressive disorder that is caused by the degeneration of nerve cells in the part of the brain called the substantia nigra, which controls movement. These nerve cells die or become impaired, losing the ability to produce an important chemical called dopamine .</p>\n<p><strong>Highyeild:</strong></p><p>The major concern with levodopa is that chronic levodopa treatment is associated with the development of motor complications in the large majority of patients. These consist of fluctuations in motor response (“on” episodes when the drug is working and “off ” episodes when parkinsonian features return as the drug wears off) and involuntary movements known as dyskinesias, which typically complicate “on” periods. When patients initially take levodopa, benefits are long-lasting (many hours) even though the drug has a relatively short half-life (60–90 min). Wearing-off occurs, in part, as a result of the short half-life of levodopa, which leads to fluctuations in plasma levodopa levels. With continued treatment, however, the duration of benefit following an individual dose becomes progressively shorter until it approaches the half-life of the drug. This loss of benefit is known as the wearing-off effect. Some patients may also experience a rapid and unpredictable switch from the “on” to the “off ” state known as the on-off phenomenon. Long-term double-blind studies show that the risk of developing motor complications can be minimized by using the lowest dose of levodopa that provides satisfactory benefit and through the use of polypharmacy to avoid the need for raising the dose of levodopa. The cause of levodopa-induced motor complications is not precisely known.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "In substantia nigra, the major neurotransmitter is:", "options": [{"label": "A", "text": "Dopaminergic", "correct": true}, {"label": "B", "text": "Acetylcholine", "correct": false}, {"label": "C", "text": "Noradrenaline", "correct": false}, {"label": "D", "text": "GABA", "correct": false}], "correct_answer": "A. Dopaminergic", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Dopaminergic Dopamine, the main neurotransmitter, is made by the cells of the substantia nigra. The basal ganglia, t he red nucleus, the substantia nigra, the reticular formation, and the cerebellum are all part of the extrapyramidal system. Dopamine pathways from the substantia nigra to the caudate nucleus and putamen.</p>\n<p><strong>Highyeild:</strong></p><p>The interplay of several specific neurotransmitters that are known to function within the basal ganglia, showing Dopamine pathways from the substantia nigra to the caudate nucleus and putamen, Gamma-aminobutyric acid (GABA) pathways from the caudate nucleus and putamen to the globus pallidus and substantia nigra, Acetylcholine pathways from the cortex to the caudate nucleus and putamen, and Multiple general pathways from the brainstem secrete norepinephrine, serotonin, and enkephalin.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: B. Acetylcholine pathways from the cortex to the caudate nucleus and putamen. Option: C. Multiple general pathways from the brainstem that secrete norepinephrine, serotonin, and Option: D. Gamma-aminobutyric acid (GABA) pathways from the caudate nucleus and putamen to the globus pallidus and substantia nigra.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 31 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A 48-year-old female comes into the ER with chest pain. An electrocardiogram shows the following finding. The QR segment best correlates with which part of the action potential of the ventricular myocyte, as shown in Image B?", "options": [{"label": "A", "text": "Phase 0, which is primarily characterized by sodium Influx.", "correct": true}, {"label": "B", "text": "Phase 0, which is primarily characterized by potassium efflux", "correct": false}, {"label": "C", "text": "Phase 1, which is primarily characterized by potassium and chloride efflux.", "correct": false}, {"label": "D", "text": "Phase 1, which is primarily characterized by calcium efflux.", "correct": false}], "correct_answer": "A. Phase 0, which is primarily characterized by sodium Influx.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Phase 0, which is primarily characterized by sodium Influx. The QR segment corresponds to ventricular depolarization , which is Phase 0 of the myocyte action potential and is characterized by sodium influx. This coordinated action of ventricular myocytes is caused by the opening of the fast Na+ channels that allow an influx of Na+ ions into the cell in Phase 0 of the action potential, leading to rapid depolarization. This portion of the action potential is affected by Class I antiarrhythmics, such as propafenone and flecainide. Image A shows a labeled beat with a P wave, QRS complex, and T wave. Image B shows a cardiac action potential with the phases labeled.</p>\n<p><strong>Highyeild:</strong></p><p>This figure demonstrates the action potential of a myocyte in the ventricles or atria. In the pacemaker cells</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B: Phase 0 is primarily driven by Na+ influx through the fast Na+ channels . Option C & D: Phase 1 follows the closure of the fast Na+ channels, and the downward deflection is driven by a net outward current driven by potassium efflux from the cell.</p>\n<p><strong>Extraedge:</strong></p><p>Major waves of the ECG. The P, QRS, and T waves are shown corresponding to characteristic action potentials in the key cardiac structures.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "An emergency room physician performs carotid massage in an attempt to slow the heart rate of a patient with supraventricular tachycardia. The physician explains to the patient that this maneuver is expected to increase vagal stimulation. A dramatic increase in the activity of vagal preganglionic axons is most likely to result in which of the following?", "options": [{"label": "A", "text": "Decrease the RR interval", "correct": true}, {"label": "B", "text": "Decrease the number of QRS complexes relative to the number of P waves", "correct": false}, {"label": "C", "text": "Decrease the PR interval", "correct": false}, {"label": "D", "text": "Decrease the duration of the ST segment", "correct": false}], "correct_answer": "A. Decrease the RR interval", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Decrease the RR interval Dramatically increased release of acetylcholine (ACh) from post-ganglionic neurons, strongly excited by vagal preganglionic axons , will hyperpolarize AV nodal fibers sufficiently to block a fraction of the impulses being conducted through the AV node. This leads to partial (second-degree) or total (third-degree) heart block. The vagal activity also will decrease rather than increase heart rate.</p>\n<p><strong>Highyeild:</strong></p><p>Parasympathetic stimulation has no effect on the mass of cardiac tissue in different regions of the heart and thus has no effect on the mean electrical axis of the heart.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option C. conduction velocity through the AV node Option D. will have little effect on action potentials in the ventricles because there is relatively little parasympathetic innervation of the ventricles.</p>\n<p><strong>Extraedge:</strong></p><p>In first-degree heart block , the number of P waves equals the number of QRS complexes, but the PR interval is prolonged. In a second-degree heart block , the number of P waves exceeds the number of QRS complexes, but each QRS complex is coordinated with a preceding P wave. In the third-degree heart block , the P waves and QRS complexes are completely independent, and the frequency of P waves exceeds the frequency of QRS complexes.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Jitendra, a 23-year-old medical student, is participating in a cardiac echocardiography study. During the isovolumetric ventricular contraction phase of the cardiac cycle, which of the following findings take place?", "options": [{"label": "A", "text": "Aortic blood pressure is falling", "correct": true}, {"label": "B", "text": "Aortic Valve is open", "correct": false}, {"label": "C", "text": "AV valves open", "correct": false}, {"label": "D", "text": "Second heart sound is produced", "correct": false}], "correct_answer": "A. Aortic blood pressure is falling", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Aortic blood pressure is falling During isovolumetric ventricular contraction, ventricular myocytes are depolarized and contract forcefully. Pressure within the ventricle is rising so that it is greater than atrial pressure but less than aortic pressure. Thus, both the AV and the aortic valves are closed. The first, not the second, heart sound is heard as the AV valve closes. Because blood is still flowing out of the aorta during this time, aortic pressure is falling.</p>\n<p><strong>Highyeild:</strong></p><p>During the rapid ventricular ejection phase, aortic pressure is rising, but during the reduced ventricular ejection phase, aortic pressure begins to fall. The majority of filling of the ventricle with blood occurs during ventricular diastole before atrial contraction.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. The aortic valve opens at the beginning of systole as the left ventricle contracts and closes before the start of diastole as the ventricle relaxes. Option C. AV valves open during ventricular diastole to permit filling. Option D. The second heart sound (S2) represents the closure of the semilunar (aortic and pulmonary) valves.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the provided images is correctly labeled for the electrode placement and polarity of the three standard limb leads?", "options": [{"label": "A", "text": "A", "correct": false}, {"label": "B", "text": "B", "correct": true}, {"label": "C", "text": "C", "correct": false}, {"label": "D", "text": "D", "correct": false}], "correct_answer": "B. B", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683533633699-QTDY031004IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>B Standard limb lead I is between the right arm and the left arm (positive electrode on the left arm). Standard limb lead II is between the right arm and the left leg ( positive electrode on the left leg). Standard limb lead III is between the left arm and the left leg (positive electrode on the left leg). Bipolar limb leads (frontal plane): Lead I: RA (-) to LA (+) (Right Left, or lateral) Lead II: RA (-) to LL (+) (Superior Inferior) Lead III: LA (-) to LL (+) (Superior Inferior) Augmented unipolar limb leads (frontal plane): Lead aVR: RA (+) to [LA & LL] (-) (Rightward) Lead aVL: LA (+) to [RA & LL] (-) (Leftward) Lead aVF: LL (+) to [RA & LA] (-) (Inferior) Unipolar (+) chest leads (horizontal plane): Leads V1, V2, V3: (Posterior Anterior) Leads V4, V5, V6:(Right Left, or lateral)</p>\n<p><strong>Highyeild:</strong></p><p>The six limb leads monitor electrical vectors (having magnitude and direction) in the frontal plane, and the six precordial leads monitor vectors in the transverse plane. Together, the leads provide a dynamic representation of the three-dimensional electrical vector resulting from the net flow of current from action potentials across the heart.</p>\n<p><strong>Extraedge:</strong></p><p>A diagram of the 12-lead placement for the ECG. The frontal plane is represented on leads I, II, and III as well as augmented leads aVR, aVL, and aVF. The cross-sectional plane is depicted on the precordial leads of the chest.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Stimulation of the parasympathetic nerves to the normal heart can lead to complete inhibition of the SA node for several seconds. During that period:", "options": [{"label": "A", "text": "P waves would become larger.", "correct": false}, {"label": "B", "text": "There would be fewer T waves than QRS complexes.", "correct": false}, {"label": "C", "text": "There would be fewer P waves than T waves.", "correct": true}, {"label": "D", "text": "There would be fewer QRS complexes than P waves.", "correct": false}], "correct_answer": "C. There would be fewer P waves than T waves.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>There would be fewer P waves than T waves. In the Parasympathetic condition, blood flows into the ventricles, and less muscle contraction is required here. This is why the P wave is smaller than the T wave.</p>\n<p><strong>Highyeild:</strong></p><p>P wave: component of the electrocardiogram that represents the depolarization of the atria T wave: component of the electrocardiogram that represents the repolarization of the ventricles Strong stimulation of the parasympathetic nerve fibers in the vagus nerves to the heart can stop the heartbeat for a few seconds, but then the heart usually escapes and beats at a rate of 20 to 40 beats/min as long as the parasympathetic stimulation continues. In addition, strong vagal stimulation can decrease the strength of heart muscle contraction by 20 to 30 percent. Such as in athletes. The vagal fibers are distributed mainly to the atria and not much to the ventricles, where the power contraction of the heart occurs. This distribution explains why the effect of vagal stimulation is mainly to decrease the heart rate rather than to greatly decrease the strength of heart contraction. Nevertheless, the great decrease in heart rate combined with a slight decrease in heart contraction strength can decrease ventricular pumping by 50 percent or more.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. The presence of tall, peaked P waves in lead II is a sign of right atrial enlargement, usually due to pulmonary hypertension/cor Option B. The T wave on the ECG (T-ECG) represents repolarization of the ventricular myocardium. any abnormalities lead to myocardial infarction etc. Option D. If there are more p-waves than QRS complexes, and the p-waves occur on time (they “march out” across the strip), then there is some type of AV block . In blocks with 2:1 conduction, two P waves occur for every QRS complex, indicating every other impulse is blocked.</p>\n<p><strong>Extraedge:</strong></p><p>In first-degree heart block , the number of P waves equals the number of QRS complexes, but the PR interval is prolonged. In a second-degree heart block , the number of P waves exceeds the number of QRS complexes, but each QRS complex is coordinated with a preceding P wave. In the third-degree heart block , the P waves and QRS complexes are completely independent, and the frequency of P waves exceeds the frequency of QRS complexes.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The P wave is normally positive in lead I of the ECG because ——", "options": [{"label": "A", "text": "Depolarization of the ventricles proceeds from the subendocardium to the Sub epicardium.", "correct": false}, {"label": "B", "text": "When the ECG electrode attached to the right arm is positive relative to the electrode attached to the left arm, an upward deflection is recorded.", "correct": false}, {"label": "C", "text": "AV nodal conduction is slower than atrial conduction.", "correct": false}, {"label": "D", "text": "Depolarization of the atria proceeds from right to left.", "correct": true}], "correct_answer": "D. Depolarization of the atria proceeds from right to left.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Depolarization of the atria proceeds from right to left. The normal P wave reflects these activation patterns. Thus, P waves are positive in lead II and usually in leads I, aVL, and aVF, reflecting the leftward and inferior direction of activation during sinus rhythm.</p>\n<p><strong>Highyeild:</strong></p><p>In normal heart ventricles, current flows from negative to positive primarily in the direction from the base of the heart toward the apex during almost the entire cycle of depolarization, except at the very end. In recording limb lead I, the negative terminal of the electrocardiograph is connected to the right arm, and the positive terminal is connected to the left arm. Therefore, when the point where the right arm connects to the chest is electronegative with respect to the point where the left arm connects, the electrocardiograph records positively, that is, above the zero voltage line in the ECG. When the opposite is true, the electrocardiograph records below the line.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Ventricular depolarization normally starts with the subendocardium (or endocardium) and spreads across the ventricular wall to the epicardium. Option B. Lead I has the positive electrode on the left arm, and the negative electrode on the right arm, and therefore measures the potential difference between the two arms. Option C. AV nodal conduction is faster than atrial conduction.</p>\n<p><strong>Extraedge:</strong></p><p>Atrial depolarization, ventricular depolarization, and ventricular repolarization move away from the exploring electrode, and the P wave, QRS complex, and T wave are, therefore, all negative (downward) deflections; aVL and aVF look at the ventricles, and the deflections are therefore predominantly positive or biphasic. There is no Q wave in V1 and V2, and the initial portion of the QRS complex is a small upward deflection because ventricular depolarization first moves across the midportion of the septum from left to right toward the exploring electrode. The wave of excitation then moves down the septum and into the left ventricle away from the electrode, producing a large S wave. Finally, it moves back along the ventricular wall toward the electrode, producing the return to the isoelectric line. Conversely, in the left ventricular leads (V4 –V6 ) there may be an initial small Q wave (left to right septal depolarization), and there is a large R wave (septal and left ventricular depolarization) followed in V4 and V5 by a moderate S wave (late depolarization of the ventricular walls moving back toward the AV junction). It should be noted that there is considerable variation in the position of the normal heart, and the position affects the configuration of the electrocardiographic complexes in the various leads.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "During the cardiac cycle, the correct statement is_______", "options": [{"label": "A", "text": "The aortic and mitral valves are never open at the same time.", "correct": true}, {"label": "B", "text": "The first heart sound is caused by the rapid ejection of blood from the ventricles.", "correct": false}, {"label": "C", "text": "The mitral valve is open throughout the diastole.", "correct": false}, {"label": "D", "text": "Left ventricular pressure is always less than aortic pressure.", "correct": false}], "correct_answer": "A. The aortic and mitral valves are never open at the same time.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The aortic and mitral valves are never open at the same time. The aortic and mitral valves are never open at the same time- During expiration, the pulmonary and aortic valves close at the same time; but during inspiration, the aortic valve closes slightly before the pulmonary . The slower closure of the pulmonary valve is due to the lower impedance of the pulmonary vascular tree. They never open at the same time.</p>\n<p><strong>Highyeild:</strong></p><p>The ventricular function can be divided into four phases: isovolumic relaxation, ventricular filling, isovolumic contraction, and rapid ventricular ejection.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: B. The first heart sound is caused by the rapid ejection of blood from the ventricles- The first is a low, slightly prolonged “lub”(first sound), caused by vibrations set up by the sudden closure of the AV valves at the start of the ventricular systole. Option: C. The mitral valve is open throughout the diastole. Option: D. Left ventricular pressure is always less than aortic pressure- Although events on the two sides of the heart are similar, t hey are somewhat asynchronous. Right atrial systole precedes the left atrial systole, and contraction of the right ventricle starts after that of the left. However, since pulmonary arterial pressure is lower than aortic pressure, right ventricular ejection begins before that of the left.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 17 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "The graph below represents the relationship of chest, lung, and both together w.r.t. the transmural pressure?", "options": [{"label": "A", "text": "A= Curve for chest wall; B= Curve for Lung; X= Residual Volume", "correct": false}, {"label": "B", "text": "A= Curve for Lung; B= Curve for Chest wall; X= Residual Volume", "correct": false}, {"label": "C", "text": "A= Curve for chest wall; B= Curve for Lung; X= Functional Residual Capacity", "correct": true}, {"label": "D", "text": "A= Curve for Lung; B= Curve for Chest wall; X= Functional Residual Capacity", "correct": false}], "correct_answer": "C. A= Curve for chest wall; B= Curve for Lung; X= Functional Residual Capacity", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683534506455-QTDY052001IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>A= Curve for chest wall; B= Curve for Lung; X= Functional Residual Capacity ' The pressure-volume curves of the total respiratory system (PT, black line), the lungs (PL, blue line), and the chest (PW, green line) are plotted together with standard volumes for functional residual capacity and tidal volume.</p>\n<p><strong>Highyeild:</strong></p><p>The transmural pressure is intrapulmonary pressure minus intrapleural pressure in the case of the lungs, intrapleural pressure minus outside (barometric) pressure in the case of the chest wall, and intrapulmonary pressure minus barometric pressure in the case of the total respiratory system. From these curves, the total and actual elastic work associated with breathing can be derived.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A . A= Curve for chest wall; B= Curve for Lung; X= Residual Volume Option B . A= Curve for Lung; B= Curve for Chest wall; X= Residual Volume Option D. A= Curve for Lung; B= Curve for Chest wall; X= Functional Residual Capacity</p>\n<p><strong>Extraedge:</strong></p><p>The compliance curves of the isolated chest wall and lungs are plotted in black while the integrated compliance curve of the chest wall-lung unit is shown in blue. This blue curve represents the summation of the transmural pressures of the isolated chest wall and lungs at a given volume. When these pressures are precisely equal and opposing, the chest wall-lung unit is at equilibrium and, as seen, this occurs at the Functional Residual Capacity. Expansion of the lung-chest wall unit beyond the FRC requires positive transmural pressures, meaning that left alone the unit would collapse, yielding exhalation. Contraction of the lung-chest wall unit below the FRC requires negative transmural pressures, meaning that left alone the unit would expand, yielding spontaneous inhalation.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "According to Weibel Airway Classification, there are 23 generations of airways. Which generation out of these shows the highest airway resistance?", "options": [{"label": "A", "text": "Alveoli", "correct": false}, {"label": "B", "text": "Trachea", "correct": false}, {"label": "C", "text": "Medium size airways", "correct": true}, {"label": "D", "text": "All of the above", "correct": false}], "correct_answer": "C. Medium size airways", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Medium size airways According to the Weibel Airway classification, there are 23 generations. The maximum airway resistance is shown by medium size airways.</p>\n<p><strong>Highyeild:</strong></p><p>Since they have a lesser radius as compared tothe According to Poiseuille-Hegan law; resistance is inversely proportional to the fourth power of the radius of airways. The greatest amount of resistance to airflow occurs not in the tiny air passages of the terminal bronchioles but in some of the larger bronchioles and bronchi near the trachea. The reason for this high resistance is that there are relatively few of these larger bronchi in comparison with the approximately 65,000 parallel terminal bronchioles, through each of which only a minute amount of air must pass. So only option C is correct, the rest are false.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. First generation: Trachea - low resistance due to large diameter.</p>\n<p><strong>Extraedge:</strong></p><p>The airways in the respiratory system progressively divide into smaller and smaller branches, resulting in an increase in total cross-sectional area and a decrease in airway resistance. The order of airway generations and the corresponding level of airway resistance can be summarized as follows: First generation: Trachea - low resistance due to large diameter Second to fourth generation: Bronchi - low resistance due to large diameter and branching structure Fifth to sixteenth generation: Bronchioles - moderate resistance due to smaller diameter Seventeen to twenty-third generation: Terminal bronchioles - high resistance due to smallest diameter and the greatest number of airways.</p>\n<p><strong>Table:</strong></p><p>Respiratory Tree Conducting Zone:- Large airways consist of the nose, pharynx, larynx, trachea, and\n bronchi. Airway resistance is highest in the large- to medium-sized bronchi. Small airways consist of bronchioles that further divide into\n terminal bronchioles (large numbers in parallel least airway resistance). Warms, humidifies, and filters air but does not participate in gas\n exchange“anatomic dead space.” Cartilage and goblet cells extend to the end of the bronchi.\n Pseudostratified ciliated columnar cells primarily make up the epithelium of the bronchus and extend to\n the beginning of terminal bronchioles, then transition to cuboidal cells.\n Clear mucus and debris from the lungs (mucociliary escalator). Airway smooth muscle cells extend to\n the end of terminal bronchioles (sparse beyond this point). 2. Respiratory\nZone:- Lung parenchyma consists of respiratory bronchioles, alveolar\n ducts, and alveoli. Participates in gas exchange. Mostly cuboidal cells in respiratory bronchioles, then simple\n squamous cells up to alveoli. Cilia terminate in respiratory\n bronchioles. Alveolar macrophages clear debris and participate in the immune response.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "With respect to fight or flight response, which neural pathway is attained by the body’s respiratory system, and via which receptors it takes place?", "options": [{"label": "A", "text": "Sympathetic – bronchodilation via beta 2 receptors.", "correct": true}, {"label": "B", "text": "Parasympathetic – bronchoconstriction via M3 receptors", "correct": false}, {"label": "C", "text": "Sympathetic – bronchoconstriction via M3 receptors", "correct": false}, {"label": "D", "text": "Parasympathetic – bronchodilation via beta 2 receptors", "correct": false}], "correct_answer": "A. Sympathetic – bronchodilation via beta 2 receptors.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Sympathetic – bronchodilation via beta 2 receptors. With respect to the fight or flight response, the neural pathway attained by the body's respiratory system is the sympathetic pathway, and it takes place via beta 2 receptors. Therefore, the correct option is A) Sympathetic - bronchodilation via beta 2 receptors.</p>\n<p><strong>Highyeild:</strong></p><p>Under emergency situations like fight or flight response, the body's respiratory system attains sympathetic neural pathways which work via beta2 receptors. These hormones bind to beta 2 receptors present in the bronchial smooth muscle, causing relaxation and dilation of the airways (bronchodilation). This helps to increase the flow of air to the lungs, which is important in supplying the body with oxygen during times of stress or physical activity.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- The parasympathetic nervous system tends to have the opposite effect on the respiratory system, leading to bronchoconstriction via M3 receptors.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Suppose you went to a hospital for a regular checkup of yours. For the checkup of your lungs, your doctor ordered pulmonary function tests by spirometry. While doing the procedure the technician asked you to breath in forcefully. Which accessory is muscle involved in forceful inspiration?", "options": [{"label": "A", "text": "Scalenus", "correct": true}, {"label": "B", "text": "Abdominal muscles", "correct": false}, {"label": "C", "text": "Internal intercostal", "correct": false}, {"label": "D", "text": "All of the above", "correct": false}], "correct_answer": "A. Scalenus", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Scalenus The accessory muscle involved in forceful inspiration during a pulmonary function test by spirometry is the scalenus muscle. Therefore, the correct option is A)</p>\n<p><strong>Highyeild:</strong></p><p>The scalenus muscle is a group of three muscles located in the neck that are involved in elevating the first two ribs during forceful inspiration. These muscles include the anterior, middle, and posterior scalenes. During deep or forceful inspiration, the scalene muscles contract to help increase the volume of the thoracic cavity and aid in the movement of air into the lungs.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- While the abdominal muscles are involved in forceful expiration, the internal intercostal muscles are involved in forced expiration, and not inspiration . Therefore, options B and C are incorrect, and the correct answer is A) Scalenus.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A chest X-ray of a patient with left-sided heart failure indicates pulmonary edema. Additional examination probably would reveal which of the following?", "options": [{"label": "A", "text": "Decreased pulmonary artery pressure", "correct": false}, {"label": "B", "text": "Decreased Pulmonary Lymph Flow", "correct": false}, {"label": "C", "text": "Increased Pulmonary Venous Pressure", "correct": true}, {"label": "D", "text": "Normal arterial oxygen partial pressure", "correct": false}], "correct_answer": "C. Increased Pulmonary Venous Pressure", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Increased Pulmonary Venous Pressure As a result of the decrease in myocardial contractility , end-diastolic pressure in the left ventricle increases, leading to an increase in the pulmonary venous and pulmonary capillary pressures. The increased pulmonary capillary hydrostatic pressure leads to increased pulmonary capillary filtration, and when filtration exceeds lymph flow, pulmonary edema develops. Pulmonary artery pressure is likely to be increased in this condition. The edema interferes with gas exchange and with lung inflation; thus, arterial oxygen partial pressure and vital capacity will be decreased.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A . Pulmonary artery pressure is likely to be increased in this condition . Option B. The increased pulmonary capillary hydrostatic pressure leads to increased pulmonary capillary filtration, and when filtration exceeds lymph flow, pulmonary edema develops . Option D . In this condition arterial oxygen partial pressure is not normal so it’s incorrect.</p>\n<p><strong>Extraedge:</strong></p><p>Pulmonary edema results in ventilation-perfusion inequality and a decrease in the diffusion of oxygen, leading to a decrease in oxygen transfer and arterial oxygen partial pressure. In a normal person who is standing or sitting upright, both blood flow and alveolar ventilation are lowest at the top of the lung and greatest near the bottom of the lung.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 15 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "The image given illustrates the extracellular and intracellular volume-osmolarity status of a patient (broken lines) and that of a normal subject (solid lines) for comparison. This patient most likely suffers from which of the following conditions?", "options": [{"label": "A", "text": "Adrenal insufficiency", "correct": false}, {"label": "B", "text": "Chronic vomiting", "correct": false}, {"label": "C", "text": "Iatrogenic fluid overload with hypertonic solution", "correct": false}, {"label": "D", "text": "Syndrome of inappropriate hypersecretion of antidiuretic hormone (SIADH)", "correct": true}], "correct_answer": "D. Syndrome of inappropriate hypersecretion of antidiuretic hormone (SIADH)", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683534360150-QTDY048001IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Syndrome of inappropriate hypersecretion of antidiuretic hormone (SIADH) The Image shown is called Darrow-Yannet diagrams. It depict changes in plasma osmolarity in various conditions. In the given Darrow-Yannet diagram there is hypo-osmotic volume expansion which is suggestive of SIADH.</p>\n<p><strong>Highyeild:</strong></p><p>In SIADH there is excessive secretion of ADH. So excess water is retained in the body. So, ECF volume rises. ECF osmolarity decreases. ECF fluid enters ICF until osmotic equilibrium is reestablished. So, ICF Volume rises. ICF osmolarity decreases.</p>\n<p><strong>Random:</strong></p><p>Explanation for incorrect options: - Type Example ECF Volume ICF Volume Osmolarity Hematocrit Plasma [protein] Isosmotic volume contraction Diarrhea; burn ↓ N.C. N.C. ↑ ↑ Hyperosmotic volume contraction Sweating; fever; diabetes insipidus ↓ ↓ ↑ N.C ↑ Hyposmotic volume contraction Adrenal insufficiency ↓ ↑ ↓ ↑ ↑ Isosmotic volume expansion Infusion of isotonic NaCl ↑ N.C. . N.C ↓ ↓ Hyperosmotic volume expansion High NaCl intake ↑ ↓ ↑ ↓ ↓ Hyposmotic volume expansion SIADH ↑ ↑ ↓ N.C. ↓</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The addition of 500 ml of hypertonic saline to the extracellular fluid leads to?", "options": [{"label": "A", "text": "A", "correct": false}, {"label": "B", "text": "B", "correct": false}, {"label": "C", "text": "C", "correct": true}, {"label": "D", "text": "None of the above", "correct": false}], "correct_answer": "C. C", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/questionImage-1718257645066-1-image.jpg"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>C The Images shown is called Darrow-Yannet diagrams. They depict changes in plasma osmolarity in various conditions.</p>\n<p><strong>Highyeild:</strong></p><p>If a hypertonic solution is added to the extracellular fluid the extracellular osmolarity increases and causes osmosis of water out of the cells into the extracellular compartment. ECF osmolarity increases. ECF volume increases As ECF osmolarity rises, fluid from the ICF moves to the ECF till osmotic equilibrium is established. So ICF osmolarity rises. ICF volume decreases. Therefore, the net effect is an increase in extracellular volume, a decrease in intracellular volume and a rise in osmolarity in both compartments. Note:- The dotted line in the diagram is the change after either addition or removal of fluid. Type Example ECF Volume ICF Volume Osmolarity Hematocrit Plasma [protein] Isosmotic volume contraction Diarrhea; burn ↓ N.C. N.C. ↑ ↑ Hyperosmotic volume contraction Sweating; fever; diabetes insipidus ↓ ↓ ↑ N.C ↑ Hyposmotic volume contraction Adrenal insufficiency ↓ ↑ ↓ ↑ ↑ Isosmotic volume expansion Infusion of isotonic NaCl ↑ N.C. . N.C ↓ ↓ Hyperosmotic volume expansion High NaCl intake ↑ ↓ ↑ ↓ ↓ Hyposmotic volume expansion SIADH ↑ ↑ ↓ N.C. ↓</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 7-year-old male child underwent a splenectomy. The nurse decided to give the child the same amount of fluid as she gives to other adult patients. In the evening rounds, you notice generalized swelling in the patient. What is the cause of edema?", "options": [{"label": "A", "text": "Extracellular hypertonicity", "correct": false}, {"label": "B", "text": "Extracellular Hypotonicity", "correct": true}, {"label": "C", "text": "Extracellular isotonicity", "correct": false}, {"label": "D", "text": "Post-op swelling is normal", "correct": false}], "correct_answer": "B. Extracellular Hypotonicity", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Extracellular Hypotonicity The cause of the generalized swelling (edema) in this 7-year-old male child who underwent splenectomy and received the same amount of fluid as adult patients could be extracellular hypotonicity.</p>\n<p><strong>Highyeild:</strong></p><p>When a patient receives an excessive amount of fluids, it can lead to a condition known as hypotonicity, where the extracellular fluid becomes less concentrated than the intracellular fluid. This can cause water to move into the cells, leading to cellular swelling and edema. In addition, the loss of the spleen can also lead to alterations in the regulation of fluid and electrolyte balance, further contributing to the development of edema. It is essential to monitor the fluid balance of pediatric patients carefully, taking into account their age, weight, and medical history, to prevent complications such as edema. Solutions that have the same osmolality as plasma are said to be isotonic. Those with greater osmolality are hypertonic. Those with lesser osmolality are hypotonic.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A: Extracellular hypertonicity will cause shrinkage of cells. Option C: Extracellular isotonicity will not cause swelling or shrinkage. Option D: Post-op swelling is not normal.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 7-month-old baby girl has been coming to your clinic with complaints of diarrhea for 7-8 episodes since yesterday. She had slipped the rotavirus vaccine. The skin of the baby is dry; the skin turgor test is slow. What is the effect on her body compartment?", "options": [{"label": "A", "text": "ECF volume increase ICF volume no change ECF osmolarity no change ICF osmolarity no change", "correct": false}, {"label": "B", "text": "ECF volume decrease ICF volume no change ECF osmolarity no change ICF osmolarity no change", "correct": true}, {"label": "C", "text": "ECF volume increase ICF volume decrease ECF osmolarity increase ICF osmolarity increase", "correct": false}, {"label": "D", "text": "ECF volume increase ICF volume increase ECF osmolarity decrease ICF osmolarity decrease", "correct": false}], "correct_answer": "B. ECF volume decrease ICF volume no change ECF osmolarity no change ICF osmolarity no change", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>ECF volume decrease ICF volume no change ECF osmolarity no change ICF osmolarity no change The clinical presentation of a 7-month-old baby girl with diarrhea and slow skin turgor test suggests that she may be dehydrated. The effect on her body compartment would be a decrease in extracellular fluid (ECF) volume, while there would be no significant change in intracellular fluid (ICF) volume or osmolarity of either ECF or ICF.</p>\n<p><strong>Highyeild:</strong></p><p>Diarrhea results in the loss of fluid and electrolytes from the body, including sodium, potassium, and chloride ions. As a result, there is a decrease in the volume of extracellular fluid (ECF), which includes plasma and interstitial fluid. This loss of ECF volume leads to a decrease in blood pressure, reduced tissue perfusion, and slower skin turgor test. However, the intracellular fluid (ICF), which constitutes the fluid inside the cells, remains relatively constant. The osmolarity of both ECF and ICF also tends to remain stable, as the body attempts to maintain the electrolyte balance across cell membranes. It is crucial to address the dehydration in this baby girl promptly, as severe dehydration can lead to electrolyte imbalances, acid-base disturbances, and potentially life-threatening complications. Treatment may involve rehydration with oral or intravenous fluids, electrolyte replacement, and management of any underlying infections.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest Options are correct because this baby girl skipped the rotavirus vaccine which might have led to diarrhea in the baby. According to the given features the baby has dehydration due to loss of water. ICF volume has no change ECF osmolarity has no change ICF osmolarity has no change Due to the loss of water, there is a decrease in the volume of ECF there is no change in osmolarity of ECF and ICF.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A patient comes to ophthalmology OPD with a BP of 190/150mmHg. She gives a history of high salt in her diet. The retina image is given below what will be the effect of such a high BP on her body fluids compartment?", "options": [{"label": "A", "text": "ECF volume increase ICF volume no change ECF osmolarity no change ICF osmolarity no change", "correct": false}, {"label": "B", "text": "ECF volume decrease ICF volume no change ECF osmolarity no change ICF osmolarity no change", "correct": false}, {"label": "C", "text": "ECF volume increase ICF volume decrease ECF osmolarity increase ICF osmolarity increase", "correct": true}, {"label": "D", "text": "ECF volume increase ICF volume increase ECF osmolarity decrease ICF osmolarity decrease", "correct": false}], "correct_answer": "C. ECF volume increase ICF volume decrease ECF osmolarity increase ICF osmolarity increase", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683534360322-QTDY048005IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>ECF volume increase ICF volume decrease ECF osmolarity increase ICF osmolarity increase In this case, the Image shows Moderate hypertensive retinopathy is characterized by thinned, straight arteries, intraretinal hemorrhages, and yellow hard exudates. The patient's history of high salt intake and a blood pressure reading of 190/150mmHg suggests that the patient may have uncontrolled hypertension, which can have significant effects on the body's fluid compartments. The effect on her body fluids compartment would be an increase in ECF volume and a decrease in ICF volume. The osmolarity of ECF and ICF increases . The increase of salt in the diet causes this situation.</p>\n<p><strong>Highyeild:</strong></p><p>Hypertension causes increased pressure within the arterial system, which can lead to increased fluid leakage into the interstitial space. This increase in the extracellular fluid (ECF) volume can cause edema in the peripheral tissues, including the retina, resulting in diabetic retinopathy-like symptoms.</p>\n<p><strong>Extraedge:</strong></p><p>Additionally, hypertension can cause increased sodium reabsorption in the kidneys, which leads to increased osmolarity of the extracellular fluid. This can result in the movement of water from the intracellular fluid (ICF) to the extracellular fluid, leading to cellular dehydration and further increasing the ECF osmolarity. It is important to manage hypertension promptly to prevent complications such as retinopathy, stroke, and kidney disease.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A man suffering from vomiting and diarrhea visited the hospital. Doctors gave normal saline intravenously 500 ml twice a day for two days since the patient was severely dehydrated. If the total body water is 42 Litres after the fluid is added. What will be the interstitial fluid present in the patient?", "options": [{"label": "A", "text": "11 L", "correct": false}, {"label": "B", "text": "10.5 L", "correct": true}, {"label": "C", "text": "10 L", "correct": false}, {"label": "D", "text": "9.5 L", "correct": false}], "correct_answer": "B. 10.5 L", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>10.5 L Assuming that the normal saline administered to the patient is isotonic and distributes evenly between the intracellular fluid (ICF) and extracellular fluid (ECF) compartments, the interstitial fluid can be estimated using the following formula: Total body water (TBW) = Intracellular fluid (ICF) + Extracellular fluid (ECF) Interstitial fluid (IF) = ECF - Plasma volume (PV) Given that the patient received 500 mL of normal saline twice a day for two days, the total volume of normal saline administered would be: Total volume of normal saline = 500 mL x 2 times a day x 2 days = 2000 mL Assuming that the normal saline is distributed evenly between the ICF and ECF compartments, the ECF volume would increase by 2000 mL, and the PV would increase by half of that amount, i.e., 1000 mL. Therefore, the new ECF volume would be: ECF = TBW - ICF = 42 L - 28 L = 14 L And the new PV would be: PV = ECF / 4 = 14 L / 4 = 3.5 L Finally, the interstitial fluid volume can be calculated as: IF = ECF - PV = 14 L - 3.5 L = 10.5 L Therefore, the estimated interstitial fluid volume in the patient would be 10.5 L after receiving 500 mL of normal saline intravenously twice a day for two days. Therefore, only the B option is correct. Rest options are false.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 21-year-old lady was admitted to the emergency due to dysmenorrhea along with loose motions and vomiting. The lady was feeling weak and couldn’t even walk on her own. Her skin doesn’t spring back quickly when pinched off and her blood pressure is 80/60. Two bags of normal saline (500ml ) was given intravenously to this patient, in this case, how much of the added fluid will remain in the vascular compartment-", "options": [{"label": "A", "text": "175ml", "correct": false}, {"label": "B", "text": "150ml", "correct": false}, {"label": "C", "text": "135ml", "correct": false}, {"label": "D", "text": "125ml", "correct": true}], "correct_answer": "D. 125ml", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>125ml In this case, the patient is presenting with symptoms of dehydration, including dysmenorrhea, vomiting, and diarrhea, along with signs of hypovolemia, such as weakness, slow skin turgor, and low blood pressure. Two bags of normal saline (500 mL each) were administered intravenously to the patient, which would increase the volume of the extracellular fluid (ECF) compartment. Approximately, 1/4th of the administered load of normal saline remains in the vascular compartment and ¾ diffuses into the interstitial space:- Therefore 500/4=125ml.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Other options are incorrect values.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Mrs. Bishnoi, A 31-year-old lady visits for kidney dialysis twice every week. She weighs 60kg. Doctors gave her 0.20g inulin to determine the dose of dialysis and after an hour concentration was found to be 1.5g/100mL. What could be the possible value for glomerular filtration rate (GFR) in this case?", "options": [{"label": "A", "text": "13.33 L", "correct": true}, {"label": "B", "text": "36L", "correct": false}, {"label": "C", "text": "13 L", "correct": false}, {"label": "D", "text": "14L", "correct": false}], "correct_answer": "A. 13.33 L", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>13.33 L To determine the GFR, the doctor administered 20 g of inulin to the patient and measured the concentration of inulin in the blood after an hour. Assuming that the inulin was distributed evenly between the intravascular (IV) and interstitial fluid (ISF) compartments and that the patient is in a steady state. GFR = (Uin x V) / Pin where Uin is the urinary concentration of inulin, V is the urine flow rate, and Pin is the plasma concentration of inulin. Since the patient is undergoing dialysis, we can assume that her urine flow rate is negligible . Therefore, the equation can be simplified as: GFR = Uin / Pin Given that the patient received 0.20 g of inulin, and the plasma concentration of inulin after an hour was 1.5 g/100 mL, we can calculate the GFR as: GFR = Uin / Pin = 0.20 g / (1.5 g/100 mL) = 13.3 mL/min Therefore the correct answer is option A. 13.3 ml/min.</p>\n<p><strong>Highyeild:</strong></p><p>Inulin is a polysaccharide that is filtered by the glomerulus of the kidney and is neither reabsorbed nor secreted by the renal tubules. Therefore, inulin clearance is a reliable indicator of glomerular filtration rate (GFR), which is a measure of renal function. Inulin doesn’t cross the membranes and equilibrates in the extracellular fluid.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. 36L is ECFV, not GFR, ECFV = K x Weight where K is a constant that depends on the patient's age, gender, and body composition. For an adult female, K is typically 0.6. Therefore, the estimated ECFV for the patient would be: ECFV = K x Weight = 0.6 x 60 kg = 36 L This means that the patient's extracellular fluid volume is approximately 36 liters. However, it is important to note that this is an estimated value, and the actual ECFV may vary depending on individual factors and medical conditions.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 50-year-old male was diagnosed with pheochromocytoma. You tell this patient that when the surgery is scheduled he has to take high salt diets and a large volume of fluids. The patient asked the reason for this out of curiosity. Being a doctor on duty you will tell the patient to-", "options": [{"label": "A", "text": "Avoid hypotension", "correct": true}, {"label": "B", "text": "Avoid palpitations", "correct": false}, {"label": "C", "text": "Avoid vasoconstriction", "correct": false}, {"label": "D", "text": "Avoid hyperglycemia", "correct": false}], "correct_answer": "A. Avoid hypotension", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Avoid hypotension < Pheochromocytoma releases excess catecholamines which leads to hypertension and concomitantly to severe inhibition of the renin-angiotensin aldosterone system. This leads to excessive loss of urinary fluid and volume depletion. Removal of tumors causes a rapid removal of sympathetic stimulation. Patients are given a salty diet and food before the operation to avoid perioperative hypovolemia and hypotension crises.</p>\n<p><strong>Highyeild:</strong></p><p>The most common feature of pheochromocytoma is hypertension and paroxysmal hypertension which may be very disturbing. Pheochromocytomas are situated in the adrenal medulla or in the abdomen near the celiac, superior mesenteric, and inferior mesenteric ganglia (sympathetic ganglia). It occurs at all ages but is common at a young age. It is more common in females. There is labile hypertension, and anxiety attacks. There is headache, excessive sweating and palpitations. There may be a pain in the chest and abdomen, with nausea and vomiting. There may be sudden flushing. Pheochromocytoma is usually suggested by the history of in a symptomatic patient, the discovery of an incidental adrenal mass, or the family history of a patient with the familial disease. Sometimes it is detected incidentally.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Options B, C, and D: hyperglycaemia, palpitations, and vasoconstriction are all adrenergic symptoms that are typically for patients with pheochromocytoma and are reduced by removing the tumor. These symptoms won’t improve by perioperative fluids and salt loading.</p>\n<p><strong>Extraedge:</strong></p><p>The adrenal medulla secretes epinephrine and norepinephrine in response to sympathetic nervous system stimulation A tumor here, called pheochromocytoma can produce uncontrolled secretions of catecholamines and therefore increases the sympathetic innervation of all organ systems.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A patient was given 1000 mg of a dye and it was found 10% of it was excreted and so the concentration was left at only 90 mg/L. What would be the volume of fluid here?", "options": [{"label": "A", "text": "9L", "correct": false}, {"label": "B", "text": "10L", "correct": true}, {"label": "C", "text": "11L", "correct": false}, {"label": "D", "text": "11.5L", "correct": false}], "correct_answer": "B. 10L", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>10L Assuming that the dye is distributed uniformly throughout the fluid compartment, we can use the following formula to calculate the volume of fluid: Amount of substance = Concentration x Volume Initially, the patient was given 1000 mg of the dye and assuming it was evenly distributed in the fluid compartment, we can write: 1000 mg = C1 x V where C1 is the initial concentration of the dye. After the patient excreted 10% of the dye, the concentration of the dye in the fluid compartment decreased to 90 mg/L. Therefore, we can write: 10 x 1000 mg = (C1 - 90 mg/L) x V Simplifying this equation, we get: 100 mg = (C1 - 90 mg/L) x V We can now substitute the first equation into the second equation to eliminate C1, and solve for V: 100 mg = [(1000 mg / V) - 90 mg/L] x V 100 mg = 1000 mg - 90 mg/L x V 90 mg/L x V = 900 mg V = 10 L Therefore, the volume of fluid in the patient is estimated to be 10 liters.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest options are not correct because Volume = amount of dye-amount excreted/concentration Volume = 1000 mg-10 mg/90 mg per L Volume = 900 mg/90 mg per L =10L Therefore, the correct option would be only B.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 14-year-old boy was brought to the hospital by his parents with complaints of blood in his urine. On asking about the history of the patient they told that the boy had a sore throat two weeks back. The blood samples were taken and reports came out with elevated blood urea.Also, BP of the patient has raised by 170/90mmHg with peripheral edema. Fluid volume in which of the following fluid compartments is increased in this patient?", "options": [{"label": "A", "text": "Intracellular", "correct": false}, {"label": "B", "text": "Interstitial", "correct": false}, {"label": "C", "text": "Intracellular and interstitial", "correct": false}, {"label": "D", "text": "Interstitial and plasma", "correct": true}], "correct_answer": "D. Interstitial and plasma", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Interstitial and plasma The patient is suffering from acute post-streptococcal glomerulonephritis, which is an acute nephritic syndrome that typically affects children. The elevated blood pressure of patient and peripheral edema are pointing towards volume expansion secondary to salt and water retention due to defects in renal excretion of sodium. The distribution of extracellular and intracellular water is a function of extracellular osmolality. If the osmolality of the extracellular fluid is above normal, as in the case of this patient from uremia(urea in the blood) , the proportion of water in the extracellular fluid increases. The peripheral edema indicates an increase in plasma volume.</p>\n<p><strong>Highyeild:</strong></p><p>Based on the symptoms and history provided, it is likely that the patient has developed acute glomerulonephritis, which is an inflammation of the glomeruli in the kidneys. This can cause an increase in fluid volume in the extracellular fluid (ECF) compartment, specifically in the interstitial fluid (ISF) compartment due to edema. The elevated blood urea level suggests that the patient may have impaired kidney function, which can lead to a decrease in the filtration of fluid from the capillaries into the ISF compartment, causing fluid to accumulate in the ECF compartment.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Options A and C: Intracellular fluid volume doesn’t increase because the patient’s extracellular fluid is hypertonic relative to the intracellular fluid due to uremia which draws water out of the intracellular space. So incorrect options.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 55-year-old male was transported to the emergency department of the hospital after fainting in his office. He is now conscious but feels weak. His vitals are as follows BP-88/60 mm hg PR-112/min RR-20/min Upon taking further history it was known that the patient was a known case of chronic peptic ulcer and was prescribed medicines, but he was not taking them regularly. What could be the possible reason for fainting in this patient?", "options": [{"label": "A", "text": "Hypovolemic shock", "correct": true}, {"label": "B", "text": "Neurogenic shock", "correct": false}, {"label": "C", "text": "Obstructive shock", "correct": false}, {"label": "D", "text": "Cardiogenic shock", "correct": false}], "correct_answer": "A. Hypovolemic shock", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Hypovolemic shock As the patient is a known case of peptic ulcer and not taking medicine regularly and possibility of bleeding is there from the ulcer. Supporting it is the low BP of the patient. So due to continuous loss of blood from the ulcer; the patient can go into hypovolemia and can present as a case of hypovolemic shock. So, option A is correct.</p>\n<p><strong>Highyeild:</strong></p><p>The patient's low blood pressure (88/60 mmHg) and high heart rate (112/min) suggest that he may be experiencing hypovolemia, which is a decrease in blood volume or blood pressure due to fluid loss or dehydration. Chronic peptic ulcer disease can lead to chronic blood loss in the gastrointestinal tract, which can result in iron-deficiency anemia and hypovolemia.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B- neurogenic shock occurs due to damage to the nervous system which impairs the cardiac system thereby reducing heart rate and BP and resulting in severe hypotension. So, option B is not true Option C- obstructive shock occurs due to obstruction of blood flow to the heart. So, option C is not true Option D- Cardiogenic shock occurs due to the failure of the heart to pump effectively. So, option D is also not true.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following methods is not used for the measurement of body fluid volumes?", "options": [{"label": "A", "text": "Aminopyrine for total body water", "correct": false}, {"label": "B", "text": "Inulin for extracellular fluid", "correct": false}, {"label": "C", "text": "Evans blue for plasma volume", "correct": false}, {"label": "D", "text": "I131 albumin for blood volume", "correct": true}], "correct_answer": "D. I131 albumin for blood volume", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>I131 albumin for blood volume I131 albumin for total body water is not commonly used for the measurement of body fluid volumes.</p>\n<p><strong>Highyeild:</strong></p><p>Measurement of Body Fluid Volumes Volume Indicators Total body water 3H2O, 2H2O, antipyrine Extracellular fluid 22Na, 125I-iothalamate, thiosulfate, inulin Intracellular fluid (Calculated as total body water− extracellular fluid volume) Plasma volume 125I-albumin, Evans blue dye (T-1824) Blood volume 51Cr-labeled red blood cells, or calculated as blood volume= plasma volume/(1 − hematocrit) Interstitial fluid (Calculated as extracellular fluid volume − plasma volume)</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest options are incorrect</p>\n<p><strong>Extraedge:</strong></p><p>Volume Indicators Total body water 3 H 2 O, 2 H 2 O, antipyrine Extracellular fluid 22 Na, 125 I-iothalamate, thiosulfate, inulin Intracellular fluid (Calculated as Total body water - Extracellular fluid volume) Plasma volume 125 I-albumin, Evans blue dye (T-1824) Blood volume 51 Cr-labeled red blood cells, or calculated as Blood volume = Plasma volume/ (1 - Hematocrit) Interstitial fluid (Calculated as Extracellular fluid volume - Plasma volume)</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "An individual is known to be suffering from diabetes mellitus. Recently, he developed hypertension. His doctor suspects that the patient may be developing renal insufficiency that leading to a reduced glomerular filtration and, as a result, hyperkalemia and hypertension. The doctor wishes to evaluate kidney function by measuring the glomerular filtration rate (GFR). She can estimate GFR best by performing a urine clearance study of which of the following substances?", "options": [{"label": "A", "text": "Creatinine", "correct": true}, {"label": "B", "text": "Para-aminohippuric acid(PAH)", "correct": false}, {"label": "C", "text": "Urea", "correct": false}, {"label": "D", "text": "Glucose", "correct": false}], "correct_answer": "A. Creatinine", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Creatinine Creatinine is a normal end-product of muscle metabolism. It is freely filtered at the glomerulus and excreted in the urine.</p>\n<p><strong>Highyeild:</strong></p><p>Although creatinine is not reabsorbed by the kidney tubules, it is partially secreted so that the rate of urinary excretion of creatinine overestimates the rate of filtration by a small percentage in healthy individuals (it overestimates more in individuals with a compromised GFR). Nonetheless, in the clinic, the clearance of creatinine can provide a reasonable estimate of GFR.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest Options are inappropriate.</p>\n<p><strong>Extraedge:</strong></p><p>GFR typically is estimated in the clinic by measuring creatinine clearance or is estimated indirectly from the plasma levels of creatinine and blood urea nitrogen (BUN). Both of these components are filtered at the glomerulus and excreted in the urine. As a result, both are inversely related to GFR.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 24-year-old man was admitted to the emergency department and complained of abdominal pain, dizziness when standing, and nausea leading to occasional vomiting. The patient’s blood pressure was low, and his heart rate was elevated. Laboratory tests revealed reduced hematocrit, hypoalbuminemia, very modest hyponatremia, and elevated creatinine, blood urea nitrogen (BUN), and renin levels. Urine output was minimal. The patient informed the physician that he had been taking extra aspirin recently to alleviate back pain. Which of the following is the most likely diagnosis?", "options": [{"label": "A", "text": "Episodes of vomiting leading to hypovolemia", "correct": false}, {"label": "B", "text": "Gastrointestinal bleeding leading to hypovolemia", "correct": true}, {"label": "C", "text": "Diarrhea Leading To Hypovolemia", "correct": false}, {"label": "D", "text": "Nephrotic syndrome is accompanied by the excretion of protein", "correct": false}], "correct_answer": "B. Gastrointestinal bleeding leading to hypovolemia", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Gastrointestinal bleeding leading to hypovolemia This patient probably has gastrointestinal bleeding caused by sensitivity to aspirin. It is well known that aspirin can induce erosions in the gastrointestinal lining that can lead to bleeding ulcers.</p>\n<p><strong>Highyeild:</strong></p><p>The bleeding will lead to loss of blood and hypovolemia that causes a decrease in capillary pressure and, as a result, a shift of fluid from the interstitial space into the vasculature. This fluid shift is apparent from the decrease in hematocrit and dilution of plasma proteins (hypoalbuminemia)</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest options are incorrect</p>\n<p><strong>Extraedge:</strong></p><p>In certain edematous settings, such as hypoalbuminemia caused by liver disease or nephrotic syndrome, the interstitial volume may be elevated (edema) and the plasma volume actually may be reduced. In cases in which plasma protein levels are reduced, thereby reducing the plasma oncotic pressure, there will be a shift in the ECF from the plasma to the interstitial space, giving rise to edema. Such conditions, which are characterized by a reduction in plasma volume (or during venous distention and accumulation of plasma volume on the venous side), are sensed by vascular volume receptors and baroreceptors as if total ECF volume were decreased, leading to retention of sodium and water and a further expansion of ECF volume in an attempt to restore plasma volume.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 25 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A 30-year-old woman experienced profound bradycardia, hypotension, and a brief period of apnea followed by rapid shallow breathing. This description is consistent with the activation of which of the following reflexes?", "options": [{"label": "A", "text": "Cushing reflex", "correct": false}, {"label": "B", "text": "Peripheral chemoreceptor reflex", "correct": false}, {"label": "C", "text": "Atrial stretch receptor reflex", "correct": false}, {"label": "D", "text": "Bezold–Jarisch reflex", "correct": true}], "correct_answer": "D. Bezold–Jarisch reflex", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Bezold–Jarisch reflex CARDIOPULMONARY CHEMOSENSITIVE RECEPTORS Activation of chemosensitive vagal C fibers in the cardiopulmonary region (e.g., juxta capillary region of alveoli, ventricles, atria, great veins, and pulmonary artery) causes profound bradycardia, hypotension, and a brief period of apnea followed by rapid shallow breathing. This response pattern is called the Bezold–Jarisch reflex.</p>\n<p><strong>Highyeild:</strong></p><p>Elicited by a variety of substances including capsaicin, serotonin, phenyl biguanide, and veratridine. The syndrome of cardiac slowing with hypotension (vasovagal syncope) has also been attributed to the activation of the Bezold–Jarisch reflex. Vasovagal syncope can occur after prolonged upright posture that results in the pooling of blood in the lower extremities and diminished intracardiac blood volume (also called postural syncope). This phenomenon is exaggerated if combined with dehydration. INTEGRATION EDGE Vasovagal syncope has been attributed to the activation of the Bezold Jarisch reflex. The most critical intervention for individuals who experience episodes of neurogenic syncope is to avoid dehydration and avoid situations that trigger the adverse event. Episodes of syncope may be reduced or prevented by an increased dietary salt intake or administration of mineralocorticoids. Vasovagal syncope has been treated with the use of β-adrenoceptor antagonists and disopyramide, an antiarrhythmic agent that blocks Na+ channels.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Cushing reflex, Cushing's triad is characterized by a widened pulse pressure, bradycardia, and irregular respirations (also known as Cheyne–Stokes respirations). Option B. Peripheral chemoreceptors (carotid and aortic bodies) detect changes in arterial blood oxygen and initiate reflexes that are important for maintaining homeostasis during hypoxemia. Option C. The Bainbridge reflex or Bainbridge effect, also called the atrial reflex, is an increase in heart rate due to an increase in central venous pressure. Increased blood volume is detected by stretch receptors (Cardiac Receptors) located on both sides of the atria at the venoatrial junctions.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 42-year-old athlete becomes alarmed when he notices a series of heart palpitations several hours after he exercises. After examining the patient’s ECG, the physician notes a sinus rhythm with occasional PVCs (premature ventricular complexes). The physician tells his patient that the palpitations are due to interpolated beats and that they are not a cause for alarm. Benign PVCs may occur because the athlete has which of the following?", "options": [{"label": "A", "text": "A prolonged PR interval", "correct": false}, {"label": "B", "text": "Bradycardia", "correct": true}, {"label": "C", "text": "ST segment depression", "correct": false}, {"label": "D", "text": "An alternative bundle of Kent", "correct": false}], "correct_answer": "B. Bradycardia", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Bradycardia A premature ventricular beat originates from ventricular pacemaker cells. Most often, these pacemaker cells are reset with each heartbeat and therefore do not produce ventricular activation. However, when the sinus rhythm is very slow (bradycardia), there is time for these pacemaker cells to reach a threshold and produce a ventricular contraction . Because the patient is a well-trained athlete, his bradycardia is an index of his good aerobic conditioning and not a cause for alarm.</p>\n<p><strong>Highyeild:</strong></p><p>If the ECG revealed a depressed ST segment, which is a sign of ventricular ischemia, the PVCs could have serious consequences. Although an inverted atrial wave can occur following a PVC (if the action potentials propagate into the atria) and a wide QRS complex, these are results, not causes of the premature contractions</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest all other options are abnormal findings and have to be worked up and treated.</p>\n<p><strong>Extraedge:</strong></p><p>Vagal Stimulation Causes Bradycardia Any circulatory reflex that stimulates the vagus nerves causes the release of acetylcholine at the vagal endings in the heart, resulting in a parasympathetic effect. Perhaps the most striking example of this phenomenon occurs in patients with carotid sinus syndrome. In these patients, the pressure receptors (baroreceptors) in the carotid sinus region of the carotid artery walls are excessively sensitive. Therefore, even mild external pressure on the neck elicits a strong baroreceptor reflex, causing intense vagal-acetylcholine effects on the heart, including extreme bradycardia.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 12 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "Which of the following is false regarding PTH secretion?", "options": [{"label": "A", "text": "Nonionic calcium is the most important stimulus for PTH secretion", "correct": true}, {"label": "B", "text": "Mg stimulates PTH secretion in the same way as Ca", "correct": false}, {"label": "C", "text": "Hypercalcemia in cancer patients is due to parathormone-related protein", "correct": false}, {"label": "D", "text": "Parathyroid senses calcium through the calcium-sensing receptor", "correct": false}], "correct_answer": "A. Nonionic calcium is the most important stimulus for PTH secretion", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Nonionic calcium is the most important stimulus for PTH secretion Circulating ionized calcium acts directly on the parathyroid glands in a negative feedback fashion to regulate the secretion of PTH .</p>\n<p><strong>Highyeild:</strong></p><p>The key to this regulation is a cell membrane receptor, CaR. Activation of this G-protein-coupled receptor leads to phosphoinositide turnover in many tissues. In the parathyroid, its activation inhibits PTH secretion. In this way, when the plasma level is high, PTH secretion is inhibited and the is deposited in the bones. When it is low, secretion is increased and is mobilized from the bones.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: B. Mg stimulates PTH secretion in the same way as Ca. Option: C. Excessive secretion of PTHrP is the most common cause of hypercalcemia of malignancy. It is also known as humoral hypercalcemia of malignancy (HHM) and accounts for about 80% of the cases. Option: D. The calcium-sensing receptor (CaSR) represents the molecular mechanism by which parathyroid cells detect changes in blood-ionized calcium concentration and modulate parathyroid hormone (PTH) secretion to maintain serum calcium levels within a narrow physiological range.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following is the active form of calcium in the body?", "options": [{"label": "A", "text": "Ionized calcium", "correct": true}, {"label": "B", "text": "Complex with phosphate", "correct": false}, {"label": "C", "text": "Complex with oxalates", "correct": false}, {"label": "D", "text": "Bound to albumin", "correct": false}], "correct_answer": "A. Ionized calcium", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Ionized calcium Ionized calcium is the physiologically active form. Cytosolic ionized calcium is maintained within the micromolar range (< 1/1000 of the serum concentration).</p>\n<p><strong>Highyeild:</strong></p><p>The calcium in the plasma is present in three forms, as shown in: About 41 percent (1 mmol/L) of the calcium is combined with the plasma proteins and in this form is non-diffusible through the capillary membrane; About 9 percent of the calcium (0.2 mmol/L) is diffusible through the capillary membrane but is combined with anionic substances of the plasma and interstitial fluids (citrate and phosphate, for instance) in such a manner that it is not ionized; The remaining 50 percent of the calcium in the plasma is both diffusible through the capillary membrane and ionized. It is the free, ionized calcium in the body fluids that is a vital second messenger and is necessary for blood coagulation, muscle contraction, and nerve function. A decrease in extracellular exerts a net excitatory effect on nerve and muscle cells in vivo.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: B. The amount of phosphate in the blood affects the level of calcium in the blood. Calcium and phosphate in the body react in opposite ways: as blood calcium levels rise, phosphate levels fall. Option: C. and Oxalate association into polynuclear stable complexes that aggregate into larger assemblies. Option: D. Ionized calcium binds to negatively charged sites on albumin protein molecules , competing with hydrogen ions for the same binding sites on albumin and other calcium-binding proteins.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A sudden decrease in serum calcium is associated with:", "options": [{"label": "A", "text": "Increased thyroxine and PTH", "correct": false}, {"label": "B", "text": "Increased phosphate", "correct": false}, {"label": "C", "text": "Increased sensitivity of muscle and nerve", "correct": true}, {"label": "D", "text": "Cardiac conduction abnormality", "correct": false}], "correct_answer": "C. Increased sensitivity of muscle and nerve", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Increased sensitivity of muscle and nerve A sudden decrease in serum calcium is associated with increased sensitivity of muscle and nerve (The best Answer). Insufficient calcium levels lead to a condition called “ neuromuscular irritability ,” which is an involuntary twitching or spasming of the muscles and nerves.</p>\n<p><strong>Highyeild:</strong></p><p>Increased Permeability of the Sodium Channels The concentration of calcium ions in the extracellular fluid also has a profound effect on the voltage level at which the sodium channels become activated. When there is a deficit of calcium ions, the sodium channels become activated (opened) by a small increase of the membrane potential from its normal, very negative level. Therefore, the nerve fiber becomes highly excitable, sometimes discharging repetitively without provocation rather than remaining in the resting state.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. A diagram showing the effects of calcitonin and parathyroid hormone (PTH) in regulating the blood calcium level in the body. Option: B. High phosphorus often does not cause symptoms itself. Option: C. Activation of these proteins by PKA phosphorylation increases systolic SR calcium release which causes both increased cardiac contraction and output.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "PTH has all the following actions except:", "options": [{"label": "A", "text": "↑es bone Reabsorption", "correct": false}, {"label": "B", "text": "Phosphaturic action", "correct": false}, {"label": "C", "text": "↑es Ca++ Reabsorption in DCT", "correct": false}, {"label": "D", "text": "↓es Ca++ excretion in urine", "correct": true}], "correct_answer": "D. ↓es Ca++ excretion in urine", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>↓es Ca++ excretion in urine ↑es bone Resorption-much better known effect of PTH and one for which the evidence is much clearer is its activation of the osteoclasts .</p>\n<p><strong>Highyeild:</strong></p><p>Phosphaturic action- Administration of PTH causes rapid loss of phosphate in the urine as a result of the effect of the hormone to diminish proximal tubular reabsorption of phosphate ions. ↑es Ca++ Reabsorption in DCT- PTH also increases renal tubular reabsorption of calcium at the same time that it diminishes phosphate reabsorption. The increased calcium reabsorption occurs mainly in the late distal tubules, the collecting tubules, the early collecting ducts, and possibly the ascending loop of Henle to a lesser extent. ↓es Ca++ excretion in urine.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- PTH has all the following actions: Option: A. ↑es bone Reabsorption Option: B. Phosphaturic action Option: C. ↑es Ca++ Reabsorption in DCT</p>\n<p><strong>Extraedge:</strong></p><p>PTH has one and only one job: That is to control the serum calcium level and keep it within the right range. If serum calcium is low, the parathyroid glands (four of them) secrete PTH. These glands make and store PTH to release it when needed. When released, PTH works with and through vitamin D to restore calcium to a normal level. PTH acts to control the serum calcium just like TSH acts on the thyroid to control the levels of thyroid hormones (T4 and T3).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "All are true of Ca++ absorption in the intestine except:", "options": [{"label": "A", "text": "Active", "correct": false}, {"label": "B", "text": "Mainly from duodenum", "correct": false}, {"label": "C", "text": "Shows adaptation", "correct": false}, {"label": "D", "text": "In renal failure, absorption is ↑ed", "correct": true}], "correct_answer": "D. In renal failure, absorption is ↑ed", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>In renal failure, absorption is ↑ed Prolonged Chronic Kidney Diseases also cause osteomalacia , a condition in which the bones are partially absorbed and, therefore, become greatly weakened. An important cause of this condition is the following: Vitamin D must be converted by a two-stage process, first in the liver and then in the kidneys, into 1,25- dihydroxycholecalciferol before it can promote calcium absorption from the intestine . Therefore, serious damage to the kidney greatly reduces the blood concentration of active vitamin D, which in turn decreases intestinal absorption of calcium and the availability of calcium to the bones.</p>\n<p><strong>Highyeild:</strong></p><p>Effects of PTH and 1,25-dihydroxycholecalciferol on whole-body calcium homeostasis: A reduction in plasma calcium stimulates the parathyroid hormone secretion. PTH in turn causes calcium conservation and production of 1,25-dihydroxycholecalciferol in the kidneys, the latter of which increases calcium uptake in the intestine. PTH also releases calcium from the readily exchangeable pool in the bone. All of these actions act to restore normal plasma calcium.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options: Ca++ absorption in the intestine:- Option A. It is Active; Calcium is absorbed in the small intestine by a general mechanism: a transcellular active transport process. Option B. Ca++ absorption in the intestine is mainly from the duodenum . Option C. It shows adaptation Ca++ absorption in the</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "All changes occur in Joints due to aging except:", "options": [{"label": "A", "text": "Water level decreases", "correct": false}, {"label": "B", "text": "Proteoglycan content decrease", "correct": false}, {"label": "C", "text": "Proteoglycan degradation increase", "correct": false}, {"label": "D", "text": "Keratin level decreases", "correct": true}], "correct_answer": "D. Keratin level decreases", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Keratin level decreases Keratin level doesn’t decrease in Joints due to aging. The following components are changed due to aging:-</p>\n<p><strong>Highyeild:</strong></p><p>As one ages, joint movement becomes stiffer and less flexible because the amount of synovial fluid decreases and the cartilage becomes thinner. Ligaments also tend to shorten and lose some flexibility, making joints feel stiff. The decrease in synovial fluid is due to a decrease in water level due to a decrease in proteoglycans. Proteoglycans decrease due to increased degradation and increased synthesis.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Water level decreases by Option: B.Proteoglycan content decreases by aging. Option: C. Proteoglycan degradation increases by aging.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following regarding actions on plasma Ca++ and PO4- is true?", "options": [{"label": "A", "text": "1,25 DHCC: ↑ Ca++ ↓Phosphate ion", "correct": false}, {"label": "B", "text": "Calcitonin: ↓ Ca++ ↑Phosphate ion", "correct": false}, {"label": "C", "text": "PTH: ↑ Ca++ ↑Phosphate ion", "correct": false}, {"label": "D", "text": "None of the above", "correct": true}], "correct_answer": "D. None of the above", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>None of the above Calcitonin inhibits bone resorption and increases the amount of in the urine. At the onset of infusion of PTH the calcium ion concentration begins to rise and reaches a plateau in about 4 hours.</p>\n<p><strong>Highyeild:</strong></p><p>However, the phosphate concentration falls more rapidly than the calcium rises and reaches a depressed level within 1 or 2 hours. The active form of vitamin D, 1, 25-dihydroxycholecalciferol, has several effects on the intestines, kidneys, and bones that increase the absorption of calcium and phosphate into the extracellular fluid and contribute to feedback regulation of these substances. Calcitonin Decreases Plasma Calcium Concentration. In some young animals, calcitonin decreases blood calcium ion concentration rapidly.</p>\n<p><strong>Extraedge:</strong></p><p>Effects of PTH and 1,25-dihydroxycholecalciferol on whole-body calcium homeostasis: A reduction in plasma calcium stimulates the parathyroid hormone secretion. PTH in turn causes calcium conservation and production of 1,25-dihydroxycholecalciferol in the kidneys, the latter of which increases calcium uptake in the intestine. PTH also releases calcium from the readily exchangeable pool in the bone. All of these actions act to restore normal plasma calcium.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 17 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "Concerning the excitation of a cardiac ventricular myocyte: a.Na+ influx during the action potential raises the intracellular Na+ concentration by - 1 0%. b. A very slow depolarization closes many Na+ channels. c. The plateau inward current is increased by sympathetic stimulation. d. The absolute refractory period is approximately as long as the active contraction. e. Repolarization is brought about mainly by the 3Na+-2K+ pump. All of the following statements are true except: Select the correct answer from the given below code:", "options": [{"label": "A", "text": "b, c, d", "correct": false}, {"label": "B", "text": "a, e, d", "correct": false}, {"label": "C", "text": "a and e", "correct": true}, {"label": "D", "text": "a and c", "correct": false}], "correct_answer": "C. a and e", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>a and e Statement: a. False-The number of Na+ ions entering the cell per action potential is very small relative to the number present around 0.02%, so intracellular Na+ concentration is not materially altered by a single action potential. Statement: b. True- Although rapid depolarization activates voltage-gated Na+ channels, slow Depolarization (e.g., by chronic hyperkalemia) allows time for the inactivation gates to close. Statement: c. True- Beta-adrenergic stimulation increases the inward Ca current, leading to a dome-shaped plateau and increased contractility. Statement: d. True- The absolute refractory period extends from the onset of depolarization to mid-repolarization, by which time relaxation is just beginning. Statement: e. False- Repolarization is brought about mainly by a passive outward K+ current through KV and KIR channels.</p>\n<p><strong>Highyeild:</strong></p><p>Characteristically, a pacemaker action potential has only three phases, designated phases zero, three, and four. Phase zero i s the phase of depolarization. Phases one and two are not present in pacemaker cells. As a result, phase zero is followed by phase three. Phase three is repolarization , involving the closing of Ca channels, blocking the flow of Ca ions. Voltage-gated K+ channels open, allowing for the efflux of K+ ions. Phase four, a phase of gradual depolarization, is unique to the pacemaker cells. The myocardiocyte action potential is different from that of pacemaker cells and has five phases, zero through four. Phase 0 is the phase of depolarization; Phase 1 through 3 is the phase during which repolarization occurs; Phase 4 is the resting phase with no spontaneous depolarization.</p>\n<p><strong>Extraedge:</strong></p><p>Characteristically, a pacemaker action potential has only three phases, designated phases zero, three, and four. Phase zero i s the phase of depolarization. Phases one and two are not present in pacemaker cells. As a result, phase zero is followed by phase three. Phase three is repolarization , involving the closing of Ca channels, blocking the flow of Ca ions. Voltage-gated K+ channels open, allowing for the efflux of K+ ions. Phase four, a phase of gradual depolarization, is unique to the pacemaker cells. The myocardiocyte action potential is different from that of pacemaker cells and has five phases, zero through four. Phase 0 is the phase of depolarization; Phase 1 through 3 is the phase during which repolarization occurs; Phase 4 is the resting phase with no spontaneous depolarization.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following statements are correct regarding the sinoatrial node?", "options": [{"label": "A", "text": "Is connected electrically to the AV Node by Purkinje fibers.", "correct": false}, {"label": "B", "text": "Has a parasympathetic innervation but the AV node does not.", "correct": false}, {"label": "C", "text": "Is the only pace-making tissue in the mammalian heart.", "correct": false}, {"label": "D", "text": "All are incorrect", "correct": true}], "correct_answer": "D. All are incorrect", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>All are incorrect None of them is correct.</p>\n<p><strong>Highyeild:</strong></p><p>The Sinoatrial node (SA) sets the heart rate. It is the \"pacemaker\" because its fastest ability to auto-depolarize and repolarize makes it the first to initiate each normal heartbeat. It is believed that the initial SA node action potential propagates from a small group of cells near the center of the SA node. The SA node is supraventricular and is sensitive to parasympathetic and sympathetic influence.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. FALSE- The atrial muscle conducts excitation from the pacemaker to the AV node. Purkinje fibers are found in the ventricles. Option: B. FALSE- Both nodes have a parasympathetic vagal innervation and a sympathetic innervation. Option: C. FALSE- Cells in the AV node, bundles, and Purkinje system can all pace make, but they do so at a lower rate than the SA node. The SA node is the normal cardiac pacemaker, impulses generated in the SA node pass through the atria from the pathways to the AV node, through this node to the bundle of His, and then its branches via the Purkinje system to the ventricular muscle.</p>\n<p><strong>Extraedge:</strong></p><p>Anatomic considerations: The SA node is located at the junction of the Superior Vena Cava with the right atrium. The AV node is located in the right posterior portion of the Interatrial septum. There are three bundles of atrial fibers that contain Purkinje-type fibers and connect the SA node to the AV node: the anterior, middle (tract of Wenckebach), and posterior (tract of Thorel) tracts. The AV node is continuous with the bundle of His, which gives off a left bundle branch at the top of the interventricular septum and continues as the Right bundle branch. The left bundle branch divides into an anterior fascicle and a posterior fascicle. The branches and fascicles run subendocardial down either side of the septum and come into contact with the Purkinje system, whose fibers spread to all parts of the ventricular myocardium. SA node is the normal cardiac pacemaker as it discharges at the highest rate.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following is true regarding the Gap junctions present in the cardiac muscle?", "options": [{"label": "A", "text": "Are absent in cardiac muscle.", "correct": false}, {"label": "B", "text": "Are present but of little functional importance in cardiac muscle.", "correct": false}, {"label": "C", "text": "Are present and provide the pathway for the rapid spread of excitation from one cardiac muscle fiber to another.", "correct": true}, {"label": "D", "text": "Are absent in smooth muscle.", "correct": false}], "correct_answer": "C. Are present and provide the pathway for the rapid spread of excitation from one cardiac muscle fiber to another.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Are present and provide the pathway for the rapid spread of excitation from one cardiac muscle fiber to another. Gap junctions provide the pathway for the rapid spread of excitation from one cardiac muscl e fiber to another.</p>\n<p><strong>Highyeild:</strong></p><p>Striated muscle, Z lines are present. The membranes of adjacent muscle fibers form folds occurring always at the Z line called intercalated discs, which is a special property of the cardiac muscle. These maintain cell-to-cell Along the sides of the muscle fibers next to the discs, the cell membranes of the adjacent muscle fibers fuse for considerable distances forming gap junctions, which permit the cardiac muscle to function as a syncytium. The T system in cardiac muscle is located at the Z lines rather than the A-I junction in skeletal muscle.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. FALSE- Myocardial fibers have a resting membrane potential of approximately −90mV.The cardiac muscle acts as a syncytium because of the presence of gap junctions. Option: B. FALSE- They permit the cardiac muscle to function as a syncytium even though no protoplasmic bridges are present between the cells. Option: D. FALSE- Are present in smooth muscle. Intercalated discs contain three different types of cell-cell junctions: Fascia adherens junctions:- Where actin filaments attach thin filaments in the muscle sarcomeres to the cell membrane. Expanded desmosomes:- Sites of strong adhesion, that help to keep the muscle cells connected when they contract. Gap junctions:- large and small, which provide direct contact between the cardiac cells, facilitating electrical communication. so that waves of depolarisation spread rapidly over the entire heart, by passing from cell to cell.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following has a slowly depolarising prepotential?", "options": [{"label": "A", "text": "SA Node", "correct": true}, {"label": "B", "text": "Atrial muscle cells", "correct": false}, {"label": "C", "text": "Bundle of his", "correct": false}, {"label": "D", "text": "Purkinje fibers", "correct": false}], "correct_answer": "A. SA Node", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>SA Node The sinoatrial node, the primary pacemaker site of the heart, has a slowly depolarizing prepotential.</p>\n<p><strong>Highyeild:</strong></p><p>Cardiac Conduction System: A healthy adult heart has a fully functioning cardiac conduction system. It is completely capable of generating an electrical impulse that is triggered by the fastest cells. The cardiac conduction system includes the following parts: the sinoatrial node, the atrioventricular bundle, the atrioventricular node, the atrioventricular bundle branches, and the Purkinje cells.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Unlike other action potentials generated in the heart, such as the (B) atrial muscle cells, (C) Bundle of His, and (D) Purkinje fibers, the d epolarizing potential carried out in the sinoatrial node is brought into the cell by slower calcium ion currents instead of the usual faster sodium ion currents. Thus, the sinoatrial node has relatively slower action potentials.</p>\n<p><strong>Extraedge:</strong></p><p>IVABRADINE: blocks the funny sodium channels; Used for treatment of Arrhythmias.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following cells/structures require calcium influx for cell membrane depolarisation at the threshold potential?", "options": [{"label": "A", "text": "AV nodal cells", "correct": true}, {"label": "B", "text": "Cardiac ventricular muscle cells", "correct": false}, {"label": "C", "text": "Nerve cell bodies", "correct": false}, {"label": "D", "text": "Presynaptic nerve terminals", "correct": false}], "correct_answer": "A. AV nodal cells", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>AV nodal cells Atrioventricular (AV) nodal cells are conduction cells in the heart that produce a slow-response action potential. This type of action potential utilizes calcium influx through voltage-dependent, primarily L-type calcium channels for depolarization (as does the sinoatrial node).</p>\n<p><strong>Highyeild:</strong></p><p>CHARACTERISTIC PROPERTY OF ACTION POTENTIAL IN SA AND AV NODES Depolarizing potentials largely due to Ca with no contribution by Na+ influx. There is no sharp, rapid depolarizing spike before the plateau. Prepotentials are prominent only in the SA and AV nodes. • Atrial and ventricular muscle fibers do not have prepotential and they discharge spontaneously only when injured or normal.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Other Options B, C, and Cardiac ventricular muscle cells, nerve cell bodies, presynaptic nerve terminals, and skeletal muscle cells, all utilize sodium influx via fast sodium channels for cell membrane depolarization.</p>\n<p><strong>Extraedge:</strong></p><p>PHASES OF VENTRICULAR ACTION POTENTIAL:- Phase 0: rapid sodium influx: rapid depolarization phase Phase 1: potassium efflux and occurs: partial or early repolarization phase Phase 2: potassium efflux and calcium influx takes place: plateau phase Phase 3: potassium efflux takes place: final repolarization phase Phase 4: the resting state is attained</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which feature does the cardiac muscle possess that is missing in the skeletal muscle?", "options": [{"label": "A", "text": "Striations", "correct": false}, {"label": "B", "text": "Multiple nuclei", "correct": false}, {"label": "C", "text": "Voluntary control", "correct": false}, {"label": "D", "text": "Intercalated discs", "correct": true}], "correct_answer": "D. Intercalated discs", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Intercalated discs Intercalated discs are the exclusive property of the myocardium which allows the whole myocardium to contract as a single unit.</p>\n<p><strong>Highyeild:</strong></p><p>Properties of cardiac muscles Striated muscle, Z lines are present. The membranes of adjacent muscle fibers form folds occurring always at the z-line called intercalated discs, which is a special property of the cardiac muscle. These maintain cell-to-cell Along the sides of the muscle fibers next to the discs, the cell membranes of the adjacent muscle fibers fuse for considerable distances forming gap junctions, which permit the cardiac muscle to function as a syncytium. The T system in cardiac muscle is located at the Z lines rather than the A-I junction in skeletal muscle.</p>\n<p><strong>Extraedge:</strong></p><p>Types of Muscles There are three main types of muscular tissue responsible for movement within the human body:- Skeletal Muscle Skeletal muscle is found attached to the skeleton and is responsible for the voluntary movement of bones Skeletal muscle fibers run in parallel tracts and are multinucleated and heavily striated Smooth Muscle Smooth muscle is found in the lining of internal organs (GI tract, uterus, blood vessels, eyes, etc.). It controls the involuntary constriction of these regions (e.g., peristalsis, vasoconstriction, pupil dilation). Smooth muscle fibers are not striated, have a spindle shape and each fiber contains a single central nucleus. Cardiac Muscle Cardiac muscle is found in the heart and is responsible for the rhythmic contraction of the heart (i.e., heartbeat) Cardiac muscle fibers are branching, intercalated, lightly striated, and have a single nucleus per fiber.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following is the difference between a cardiac muscle and a skeletal muscle?", "options": [{"label": "A", "text": "Cardiac muscle is not striated and skeletal muscle is striated.", "correct": false}, {"label": "B", "text": "Cardiac muscle fibers are branched and skeletal muscles are not.", "correct": true}, {"label": "C", "text": "Skeletal muscle is involuntary and uninucleate and cardiac muscle is neither.", "correct": false}, {"label": "D", "text": "Skeletal muscle has intercalated discs and cardiac muscle doesn’t.", "correct": false}], "correct_answer": "B. Cardiac muscle fibers are branched and skeletal muscles are not.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Cardiac muscle fibers are branched and skeletal muscles are not. Skeletal muscles are unbranched and Cardiac muscles are branched.</p>\n<p><strong>Highyeild:</strong></p><p>Properties of cardiac muscles Striated muscle, Z lines are present. The membranes of adjacent muscle fibers form folds occurring always at the z-line called intercalated discs, which is a special property of the cardiac muscle. These maintain cell-to-cell Along the sides of the muscle fibers next to the discs, the cell membranes of the adjacent muscle fibers fuse for considerable distances forming gap junctions, which permit the cardiac muscle to function as a syncytium. The T system in cardiac muscle is located at the Z lines rather than the A-I junction in skeletal muscle.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Cardiac muscle fibers are striated, branched, and Smooth muscle is non-striated, unbranched, and spindle-shaped. Skeletal muscle is striated, unbranched, and</p>\n<p><strong>Extraedge:</strong></p><p>Types of Muscles There are three main types of muscular tissue responsible for movement within the human body:- Skeletal Muscle Skeletal muscle is found attached to the skeleton and is responsible for the voluntary movement of bones Skeletal muscle fibers run in parallel tracts and are multinucleated and heavily striated Smooth Muscle Smooth muscle is found in the lining of internal organs (GI tract, uterus, blood vessels, eyes, etc.) It controls the involuntary constriction of these regions (e.g., peristalsis, vasoconstriction, pupil dilation) Smooth muscle fibers are not striated, have a spindle shape and each fiber contains a single central nucleus Cardiac Muscle Cardiac muscle is found in the heart and is responsible for the rhythmic contraction of the heart (i.e., heartbeat) Cardiac muscle fibers are branching, intercalated, lightly striated, and have a single nucleus per fiber.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The SA node acts as the pacemaker of the heart because:", "options": [{"label": "A", "text": "Has rich sympathetic stimulation", "correct": false}, {"label": "B", "text": "Generates impulse spontaneously", "correct": false}, {"label": "C", "text": "Generates impulse at the highest rate", "correct": true}, {"label": "D", "text": "Has poor cholinergic innervation", "correct": false}], "correct_answer": "C. Generates impulse at the highest rate", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Generates impulse at the highest rate The discharge rate of the sinus node is considerably faster than the natural self-excitatory discharge rate of either the A-V node or the Purkinje fibers. Each time the sinus node discharges, its impulse is conducted into both the A-V node and the Purkinje fibers, also discharging their excitable membranes. However, the sinus node discharges again before either the A-V node or the Purkinje fibers can reach their own thresholds for self-excitation. Therefore, the new impulse from the sinus node discharges both the A-V node and the Purkinje fibers before self-excitation can occur in either of these sites. Thus, the sinus node controls the beat of the heart because its rate of rhythmical discharge is faster than that of any other part of the heart. Therefore, the sinus node is almost always the pacemaker of the normal heart. In the normal human heart, each beat originates in the SA node (normal sinus rhythm, NSR). The heart beats about 70 times a minute at rest. The rate is slowed (bradycardia) during sleep and accelerated (tachycardia) by emotion, exercise, fever, and many other stimuli.</p>\n<p><strong>Highyeild:</strong></p><p>In healthy young individuals breathing at a normal rate, the heart rate varies with the phases of respiration: It accelerates during inspiration and decelerates during expiration, especially if the depth of breathing is increased. This sinus arrhythmia is a normal phenomenon and is primarily due to fluctuations in parasympathetic output to the heart. During inspiration, impulses in the vagi from the stretch receptors in the lungs inhibit the cardio-inhibitory area in the medulla oblongata. The tonic vagal discharge keeps the heart rate slowly decreasing, and the heart rate rises. Disease processes affecting the sinus node lead to marked bradycardia accompanied by dizziness and syncope.</p>\n<p><strong>Extraedge:</strong></p><p>Sick sinus syndrome (bradycardia-tachycardia syndrome; sinus node dysfunction): is a collection of heart rhythm disorders that include sinus bradycardia (slow heart rates from the natural pacemaker of the heart), tachycardias (fast heart rates), and bradycardia-tachycardia (alternating slow and fast heart rhythms). Sick sinus syndrome is relatively uncommon and is usually found in people older than 50, in whom the cause is often a nonspecific, scar-like degeneration of the heart’s conduction system. When found in younger people, especially in children, a common cause of sick sinus syndrome is heart surgery, especially in the upper chambers. Holter monitoring is an effective tool for diagnosing sick sinus syndrome because of the episodic nature of the disorder. Extremely slow heart rate and prolonged pauses may be seen during Holter monitoring, along with episodes of atrial tachycardias. Abnormal pacemaker: A pacemaker elsewhere than the sinus node is called an “ectopic” pacemaker. An ectopic pacemaker causes an abnormal sequence of contraction of the different parts of the heart and can cause significant debility of heart pumping. The new pacemaker then occurs most frequently at the A-V node or in the penetrating portion of the A-V bundle on the way to the ventricles.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The plateau phase of the ventricular muscle is due to the opening of the:", "options": [{"label": "A", "text": "Na+ channels", "correct": false}, {"label": "B", "text": "K+ channels", "correct": false}, {"label": "C", "text": "Cl- channels", "correct": false}, {"label": "D", "text": "Ca2+ channel", "correct": true}], "correct_answer": "D. Ca2+ channel", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Ca2+ channel Ventricular muscle is due to the opening of the Ca channels.</p>\n<p><strong>Highyeild:</strong></p><p>PLATEAU PHASE OF VENTRICULAR ACTION POTENTIAL In phase 2 (plateau), calcium channels open, and fast potassium channels close. Brief initial repolarization occurs and the action Potentials then plateaus as a result of: Increased calcium ion permeability Decreased potassium ion permeability The voltage-gated calcium ion channels open slowly during phases 1 and 0, and calcium enters the cell. Potassium channels then close, and the combination of decreased potassium ion efflux and increased calcium ion influx causes the action potential to plateau. The individual fibers are separated by membranes, but membrane depolarization spreads radially through them as if they were a syncytium because of the presence of gap junctions.</p>\n<p><strong>Extraedge:</strong></p><p>PHASES OF VENTRICULAR ACTION POTENTIAL Phase 0: rapid sodium influx: rapid depolarization phase Phase 1: potassium efflux and occurs: partial or early repolarization phase Phase 2: potassium efflux and calcium influx takes place: plateau phase Phase 3: potassium efflux takes place: final repolarization phase Phase 4: the resting state is attained</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "What will cause the sinoatrial node to depolarise more frequently?", "options": [{"label": "A", "text": "Acetylcholine", "correct": false}, {"label": "B", "text": "Norepinephrine", "correct": true}, {"label": "C", "text": "Parasympathetic stimulation", "correct": false}, {"label": "D", "text": "Vagus nerve", "correct": false}], "correct_answer": "B. Norepinephrine", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Norepinephrine Norepinephrine released by the sympathetic nervous system acting on the SA node increases the heart rate and blood pressure. Parasympathetic stimulation along the vagus nerve decreases the heart rate.</p>\n<p><strong>Highyeild:</strong></p><p>EFFECT OF SYMPATHETIC AND CHOLINERGIC SYSTEM ON THE AP OF THE SA NODE When the cholinergic vagal fibers to nodal tissue are stimulated, the membrane becomes hyperpolarized and the slope of the prepotential is decreased because the Ach released at the nerve endings increases the K+ conductance of nodal tissue. This action is mediated by M2 muscarinic receptors, which, via the By subunit of a G protein, open a special set of K+ channels. In addition, activation of the M2 receptors decreases cyclic adenosine 3',5'- monophosphate (CAMP) in the cells, and this slows the opening of Ca The result is a decrease in the firing rate. Strong vagal stimulation may abolish spontaneous discharge for some time.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Acetylcholine (ACh) released on vagal stimulation reduces the heart rate by increasing the K+ conductance of pacemaker cells in the sinoatrial (S-A) node. Option C. Parasympathetic (vagal) activation, which releases acetylcholine onto the SA node that binds to muscarinic receptors, decreases pacemaker rate (phase 4 slope) by increasing potassium conductance and decreasing the pacemaker currents (If) and slowing inward calcium currents. Option D. The right vagus nerve primarily innervates the SA node , whereas the left vagus innervates the AV node.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The order of depolarization after the stimulation of the Purkinje fibers is:", "options": [{"label": "A", "text": "Septum→ Endocardium→ Epicardium", "correct": true}, {"label": "B", "text": "Endocardium→ Epicardium→ Septum", "correct": false}, {"label": "C", "text": "Epicardium→ Endocardium→ Septum", "correct": false}, {"label": "D", "text": "Septum→ Epicardium→ Endocardium", "correct": false}], "correct_answer": "A. Septum→ Endocardium→ Epicardium", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Septum→ Endocardium→ Epicardium The order of depolarization is from the septum, endocardium to the epicardium.</p>\n<p><strong>Highyeild:</strong></p><p>The spread of Cardiac Excitation: Atrial depolarization is initiated from the SA node spreads radially through atria, then converges on the AV node. A delay of about O.1 s (AV nodal delay) occurs before excitation spreads to the ventricles. Ventricular depolarization starts at the left side of the interventricular septum and moves first to the right across the midportion of the septum. It moves along the ventricular walls to the AV groove, proceeding from the endocardial to the epicardial surface.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest orders are inappropriate; the correct order of depolarization after the stimulation of the Purkinje fibers is Septum→ Endocardium→ Epicardium.</p>\n<p><strong>Extraedge:</strong></p><p>The Purkinje fibers allow for a coordinated and controlled rhythm of blood circulation. Purkinje fibers comprise a distinct type of cardiac muscles that secure them the numerous efficient and quickest conductors of impulses in the cardiac system. The histology of Purkinje fibers reveals that they have thinner muscle tissues with fewer muscle strands than standard cardiac cells, which makes them appear lighter than different cells in a stained slide.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 21 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A healthy 26-year-old participates in a 10 km Army-run competition. Which of the following factor directly affects this person’s Cardiac Output except:-", "options": [{"label": "A", "text": "The Basic level of Body Metabolism", "correct": false}, {"label": "B", "text": "The Physically Active Person in Various Sports", "correct": false}, {"label": "C", "text": "The Person’s Age and Size of body", "correct": false}, {"label": "D", "text": "The Person’s Race, Skin Color", "correct": true}], "correct_answer": "D. The Person’s Race, Skin Color", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The Person’s Race, Skin Color In this scenario, Cardiac Output is not dependent on Person's Skin Tone or Race .</p>\n<p><strong>Highyeild:</strong></p><p>Factors that cause a Hypereffective Heart Nerve excitation can increase heart pumping Heart Hypertrophy can increase Pumping Effectiveness Factors that cause Hypoeffective Heart Severe hypertension:- Increase the arterial pressure against which the heart must pump. Heart attack because of Coronary artery Blockage. Valvular Heart Disease, Congenital heart disease. Myocarditis Cardiac hypoxia etc.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Options: A, B, and C. are true because:- The cardiac output varies widely with the level of activity of the body. The following factors, among others, directly affect cardiac output:- The basic level of body metabolism , Whether the person is exercising, The person's age, and The size of the body.</p>\n<p><strong>Extraedge:</strong></p><p>For young, healthy men, resting cardiac output averages about 5.6 L/minutes . For women, this value is about 4.9 L/minute .</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 31-year-old pregnant woman comes to the clinic for ANV. She explained her daily routines, and she is a resident of North India, where temperatures do not change much. So this woman’s cardiac output increased in:", "options": [{"label": "A", "text": "Moderate Changes in Environmental temperature", "correct": false}, {"label": "B", "text": "Sleep", "correct": false}, {"label": "C", "text": "Standing", "correct": false}, {"label": "D", "text": "Pregnancy", "correct": true}], "correct_answer": "D. Pregnancy", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Pregnancy Cardiac output is increased during pregnancy. Expanded blood volume, reduced systemic vascular resistance and blood pressure also increased in pregnancy. These changes contribute to the optimal growth and development of the</p>\n<p><strong>Highyeild:</strong></p><p>Measurement of Cardiac Output: Fick’s Law : CO = Total body Consumption per minute/ arteriovenous oxygen difference. Echo : Ultrasound of heart, Record all volumes. Dye dilution method : CO = Amount of Dye/ Concentration X Time. Thermodilution : Calculate CO from Temperature Change. Note:- Dilution methods are not accurate if shunts/fistula/regurgitation are present.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A . Moderate Changes in Environmental temperature do not impact Cardiac Option: B . No significant changes occurred in heart rate or stroke volume during sleep. Option: C . On standing in the initial response, Cardiac Output is reduced because Stroke Volume decreased.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 55-year-old man is noted to have congestive heart failure and states that he is comfortable at rest but becomes dyspneic even with walking to the bathroom. On echocardiography, he is noted to have an ejection fraction of 47%. What is the Normal Ejection Fraction?", "options": [{"label": "A", "text": "65%", "correct": true}, {"label": "B", "text": "50%", "correct": false}, {"label": "C", "text": "45%", "correct": false}, {"label": "D", "text": "35%", "correct": false}], "correct_answer": "A. 65%", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>65% ' Normal EF is about 65% , Ejection fraction is SV/EDV. The case description shows Diastolic dysfunction , when the ejection fraction exceeds 40%, there is likely diastolic dysfunction, with stiff ventricles. The amount of blood ejected by each ventricle per stroke at rest is 70-90 mL. The end-diastolic ventricular volume is about 130 mL.</p>\n<p><strong>Highyeild:</strong></p><p>Heart failure can be caused by impaired systolic function (ejection fraction <40%) or impaired diastolic function (with preserved systolic ejection fraction).</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Normal EF is about 65%, Rest of other values are incorrect.</p>\n<p><strong>Extraedge:</strong></p><p>HFrEF, or heart failure with a reduced ejection fraction, is heart failure with an LVEF of less than 40%. HFpEF is typically defined as heart failure with a left ventricular ejection fraction, or LVEF, of 50% or greater.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which volume determines the preload?", "options": [{"label": "A", "text": "End Systolic Volume", "correct": false}, {"label": "B", "text": "End Diastolic Volume", "correct": true}, {"label": "C", "text": "Ventricular Ejection Volume", "correct": false}, {"label": "D", "text": "The volume of Blood in the aorta", "correct": false}], "correct_answer": "B. End Diastolic Volume", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>End Diastolic Volume Volume determining preload is End diastolic volume. Preload is the initial stretch of muscle at the end of the diastole. Preload is equal to End diastolic volume (EDV) and is determined by a venous return to the heart.</p>\n<p><strong>Highyeild:</strong></p><p>Increasing EDV will increase the load on the ventricle even before the contraction starts. Hence, it is called Preload. EDV Depends on Ventricular compliance and Venous Return. EDV Normal Range is 120-130ml</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect options:- Rest options are not corresponding to Preload because Preload is approximated by ventricular end-diastolic volume (EDV) ; it depends on the venous tone and circulating blood volume.</p>\n<p><strong>Extraedge:</strong></p><p>End systolic volume (ESV) is Blood left in the ventricle at the end of systole. ESV = EDV - SV ESV Normal Range is 40-50ml</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 29-year-old female has a heart rate of 80 beats per minute. Her pressure-volume figure for the left ventricle is given below. At a point that corresponds to 120 ml, what is the cardiac output (in ml/min)?", "options": [{"label": "A", "text": "4000", "correct": false}, {"label": "B", "text": "4900", "correct": false}, {"label": "C", "text": "5600", "correct": true}, {"label": "D", "text": "6000", "correct": false}], "correct_answer": "C. 5600", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>5600 ml In this case scenario, the patient has a 80 beats/min HR and Stroke volume needs to be figured out by the given Pressure-volume Curve. Point A corresponds to the ESV = 50 ml. Point B corresponds to the EDV = 120 ml. So, stroke volume (SV) = EDV-ESV => 120-50 = 70 ml. Therefore, cardiac output = HR x SV = 80 x 70 = 5600 ml.</p>\n<p><strong>Extraedge:</strong></p><p>Pressure-volume (PV) loops are the gold standard for measuring direct, real-time cardiac function.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 66-year-old male presents with angina and dyspnea on exertion. Auscultation of the chest reveals a loud systolic murmur. He is diagnosed with aortic valvular sclerosis. This stenosis of the aortic valve will cause a murmur that can be heard loudest at which interval shown in the below figure?", "options": [{"label": "A", "text": "Between A and B", "correct": false}, {"label": "B", "text": "Between B and C", "correct": false}, {"label": "C", "text": "Between C and D", "correct": true}, {"label": "D", "text": "Between D and A", "correct": false}], "correct_answer": "C. Between C and D", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Between C and D Blood passes through the aortic valve, starting when the aortic valve opens at point C until it closes at point D. Hence, aortic valve stenosis will cause turbulent blood flow (murmur) between C and D.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Between A and B is the interval of diastolic filling when the aortic valve is closed. Option: B. Between B and C is the period of isovolumetric contraction (choice B) before the aortic valve opens. Option: D. Between D and A is the period of isovolumetric relaxation after the aortic valve closes.</p>\n<p><strong>Extraedge:</strong></p><p>Changes in Pressure-Volume Curve:- ↑ Preload (↑EDV) → ↑ strength of contraction → 1 stroke volume →larger loop ↑ afterload → ↑ ventricular pressure during isovolumetric contraction → ↑ less blood leaves ventricle→ end-systolic volume. (ESV) → ↓ SV → loop narrower, taller (smaller SV, higher pressure; stroke work remains relatively stable). ↑contractility → blood under ↑ pressure → longer ejection phase → left ventricular pressure = aortic pressure→ ↑ SV, stroke work, ↓ ejection fraction (EF), EDV→ loop widens.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 29-year-old male patient comes to the DBMCI clinic with complaints of weakness, restlessness, and chest pain. On examination, his blood pressure is found to be 90/60 mmHg, his heart sounds are muffled, and his neck veins are distended. What is the typical JVP finding in this patient?", "options": [{"label": "A", "text": "Absent a wave", "correct": false}, {"label": "B", "text": "Prominent a wave", "correct": false}, {"label": "C", "text": "Rapid y descent", "correct": false}, {"label": "D", "text": "Absent y descent", "correct": true}], "correct_answer": "D. Absent y descent", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Absent y descent This case scenario describes Cardiac Tamponade. The typical JVP finding in Cardiac Tamponade is absent y-descent. Hypotension, soft or absent heart sounds, and jugular venous distention (Beck's triad) are the three principal features of cardiac tamponade. JVP shows a prominent x (early systolic) descent and an absent y (early diastolic) descent because of the ventricle's limited or absent early diastolic filling.</p>\n<p><strong>Highyeild:</strong></p><p>The waveforms seen in a normal JVP are:- a wave corresponds to atrial contraction and occurs just after the P wave (on ECG) and just before the first heart sound. c wave represents the bulging of the tricuspid valve into the right atrium during ventricular systole. x descent corresponds to the atrial relaxation during atrial diastole. v wave represents atrial filling during ventricular systole and peaks at the second heart sound. y descent represents passive emptying of the right atrium into the right ventricle after the tricuspid valve opening.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "If one considers a single vessel within each division of the systemic circulation in a person who is lying down, one can arrange the vessels according to the end pressure, greatest to least, within each vessel. (If the vessel exhibits a pulse pressure, one can consider the mean end pressure.) Which of the following sequences of mean end pressure is correct in this case?", "options": [{"label": "A", "text": "Large artery → large vein → arteriole → venule → capillary", "correct": false}, {"label": "B", "text": "Capillary → arteriole → venule → large artery → large vein", "correct": false}, {"label": "C", "text": "Large artery → arteriole → capillary → venule → large vein", "correct": true}, {"label": "D", "text": "Large vein → venule → capillary → arteriole → large artery", "correct": false}], "correct_answer": "C. Large artery → arteriole → capillary → venule → large vein", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Large artery → arteriole → capillary → venule → large vein In a supine person, the effect of gravity is essentially nil, and intravascular pressures are caused by contractions of the heart. Because fluid flows from regions of higher pressure to regions of lower pressure, pressures must be higher in the large arteries than in the arterioles, then in the capillaries, then in the venules, then in the large veins.</p>\n<p><strong>Highyeild:</strong></p><p>The velocity of blood flow is highest in the large arteries, slowest in the capillaries, and intermediate in the veins because of variations in the total cross-sectional areas of these vascular beds. Blood flow in all regions of the vasculature normally is non-turbulent (laminar); however, it can become turbulent in diseased arteries as a result of the high velocity of flow. The pressure that causes flow is highest in the large arteries and lowest in the large veins. Pressure falls dramatically as blood flows through the small arteries and arterioles because of the high resistance to flow provided by these vessels.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest Sequences are incorrect, so the correct answer is option C.</p>\n<p><strong>Extraedge:</strong></p><p>The difference between systolic and diastolic pressures is pulse The amplitude of the pulse pressure is influenced mainly by stroke volume and the capacitance (stiffness) of the large arteries.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 67-year-old patient undergoes cardiac transplantation for severe idiopathic cardiomyopathy. Upon release from the hospital, the patient is referred to a cardiac rehabilitation program. The exercise physiologist starts the patient on a walking regimen. During exercise in cardiac transplant patients, cardiac output increases primarily due to an increase in which of the following?", "options": [{"label": "A", "text": "Arterial blood pressure", "correct": false}, {"label": "B", "text": "Heart rate", "correct": false}, {"label": "C", "text": "Stroke volume", "correct": true}, {"label": "D", "text": "TPR (temperature, pulse, respiration)", "correct": false}], "correct_answer": "C. Stroke volume", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Stroke volume Normally, cardiac output increases during exercise primarily due to sympathetically mediated increases in heart rate. Patients with transplanted hearts are able to increase their cardiac output during exercise in the absence of cardiac innervation through increases in stroke volume .</p>\n<p><strong>Highyeild:</strong></p><p>The mechanisms for the increase in stroke volume are an increase in preload (Frank-Starling mechanism) and myocardial contractility (from circulating catecholamines). Preload is the degree of stretch on ventricular myocardial cells as determined by the volume of blood within the ventricles at the end of diastole.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. An increase in arterial pressure (e., afterload) would decrease stroke volume and thus cardiac output. Option: B. Cardiac allografts are enervated such that the sympathetic nervous system is disconnected from the heart, and thus heart rate does not increase appreciably during exercise in cardiac transplant patients. Option: D. because of vasodilation in the contracting muscles, total peripheral resistance is decreased (not increased).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 23-year-old collegiate dance squad member adopts a sedentary lifestyle once she starts medical school. After the Gross Anatomy course, she decides to restore her state of physical fitness by resuming a regular exercise routine. The cardiovascular responses to isotonic exercise include an increase in which of the following?", "options": [{"label": "A", "text": "Stroke volume", "correct": true}, {"label": "B", "text": "Diastolic pressure", "correct": false}, {"label": "C", "text": "Venous compliance", "correct": false}, {"label": "D", "text": "Pulmonary arterial resistance", "correct": false}], "correct_answer": "A. Stroke volume", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Stroke volume During exercise, sympathetic stimulation of the heart increases contractility, and thus stroke volume.</p>\n<p><strong>Highyeild:</strong></p><p>A decrease in venous compliance, caused by sympathetic stimulation, increases venous return to the heart, which also increases stroke volume by a Frank-Starling mechanism. The increased stroke volume, coupled with an increase in heart rate, cause an increase in cardiac output.</p>\n<p><strong>Random:</strong></p><p>Explanation for incorrect options:- Option: B . Diastolic pressure: Systemic arterial pressure also increases in response to the increase in cardiac output. However, the fall in total peripheral resistance, which is caused by the dilation of the blood vessels within the exercising muscles, results in a decrease in diastolic pressure. Option: C. Venous compliance: acute exercise does not improve venous volume and compliance in both the exercising and non‐exercising limbs. However, endurance exercise training for 6–8 weeks leads to increases in venous volume and compliance in the limbs. Option: D. Pulmonary arterial resistance: The pulmonary vessels undergo passive dilation as more blood flows into the pulmonary circulation. As a result, pulmonary vascular resistance decreases.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A cardiac catheterization is performed on a 39-year-old man who presents with angina. The left ventricular pressure-volume curve shows a decreased stroke volume and ejection fraction. Which of the following mechanisms may compromise stroke volume following myocardial infarction?", "options": [{"label": "A", "text": "An increase in central venous pressure", "correct": false}, {"label": "B", "text": "An increase in heart rate", "correct": true}, {"label": "C", "text": "A decrease in systemic blood pressure", "correct": false}, {"label": "D", "text": "A decrease in total peripheral resistance", "correct": false}], "correct_answer": "B. An increase in heart rate", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>An increase in heart rate Increasing heart rate (in isolation without increasing contractility) decreases the time for filling during diastole and may decrease preload and therefore, stroke volume.</p>\n<p><strong>Highyeild:</strong></p><p>EF(ejection fraction) is an index of ventricular contractility (↓se in systolic heart failure; usually normal in diastolic heart failure.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. An increase in central venous pressure: Increased CVP means increased preload which increases stroke volume A decrease in cardiac output either due to decreased heart rate or stroke volume (e.g., in ventricular failure) results in blood backing up into the venous circulation (increased venous volume) as less blood is pumped into the arterial circulation. The resultant increase in thoracic blood volume. increases CVP. Hence, CVP is an indicator of preload and effective circulating volume. Option: C. A decrease in systemic blood pressure: decreasing afterload by decreasing total peripheral resistance or systemic blood pressure will cause an increase in stroke volume. Option: D. A decrease in total peripheral resistance: Increases stroke volume.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Select the correct in the images marked A and B?", "options": [{"label": "A", "text": "Image A is preload, image B is afterload", "correct": true}, {"label": "B", "text": "Image A is afterload, image B is preload", "correct": false}, {"label": "C", "text": "Image A is conduction of impulse in heart, image B is conduction in interatrial septum", "correct": false}, {"label": "D", "text": "Only B and C are correct", "correct": false}], "correct_answer": "A. Image A is preload, image B is afterload", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683531940961-QTDY006012IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Image A is preload, image B is afterload Preload:- Preload is the stretching of the cardiac muscle fibers at the end of diastole, just before contraction. It is due to an increase in ventricular pressure caused by filling of blood during diastole . Stretching of muscle fibers increases their length, which increases the force of contraction and cardiac output Afterload:- Afterload is the force against which ventricles must contract and eject the blood. Force is determined by the arterial pressure . At the end of isometric contraction period , semilunar valves are opened and blood is ejected into the aorta and pulmonary artery.</p>\n<p><strong>Highyeild:</strong></p><p>Preload Preload approximated by ventricular end- diastolic volume (EDV); depends on venous tone and circulating blood volume. Afterload Afterload approximated by MAP. .↑ wall tension per Laplace's law →↑ pressure →↑afterload. LV compensates for ↑afterload by thickening (hypertrophy) in order to ↓wall stress.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest all other matches are incorrect.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The dicrotic notch on the aortic pressure curve is caused by?", "options": [{"label": "A", "text": "Closure of the mitral valve", "correct": false}, {"label": "B", "text": "Closure of the tricuspid valve", "correct": false}, {"label": "C", "text": "Closure of the aortic valve", "correct": true}, {"label": "D", "text": "Closure of the pulmonary valve", "correct": false}], "correct_answer": "C. Closure of the aortic valve", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Closure of the aortic valve Dicrotic notch is caused by closing of the aortic valve.</p>\n<p><strong>Highyeild:</strong></p><p>The dicrotic notch, a small oscillation in the falling phase of the pulse wave caused by vibrations set up when the aortic valve shuts.</p>\n<p><strong>Extraedge:</strong></p><p>In septic shock, there is profound vasodilation and hypotension. The diastolic BP is low as a result of this. Due to a lower vascular resistance on the arterial side, the aortic valve takes a longer time to close, hence the dicrotic notch appears later in the arterial trace.If the patient is put on a high dose of vasoconstrictors, then due to higher vascular resistance on the arterial side, the aortic valve closes a bit earlier, and hence the dicrotic notch appears earlier on the wave.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Coronary blood stops during:", "options": [{"label": "A", "text": "Protodiastole", "correct": false}, {"label": "B", "text": "End of diastole", "correct": false}, {"label": "C", "text": "Isometric relaxation", "correct": false}, {"label": "D", "text": "Isovolumetric contraction", "correct": true}], "correct_answer": "D. Isovolumetric contraction", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Isovolumetric contraction During contraction of the ventricular myocardium (systole), the subendocardial coronary vessels are compressed due to the high ventricular pressures. This compression results in momentary retrograde blood flow (i.e., blood flows backward toward the aorta) which further inhibits perfusion of myocardium during systole. However, the epicardial coronary vessels (the vessels that run along the outer surface of the heart) remain open. Because of this, blood flow in the subendocardium stops during ventricular contraction.</p>\n<p><strong>Highyeild:</strong></p><p>As a result, most myocardial perfusion occurs during heart relaxation (diastole) when the subendocardial coronary vessels are open and under lower pressure. Flow never comes to zero in the right coronary artery, since the right ventricular pressure is less than the diastolic blood pressure.</p>\n<p><strong>Extraedge:</strong></p><p>The artery that supplies the posterior third of the interventricular septum – the posterior descending artery (PDA) determines the coronary dominance. If the posterior descending artery is supplied by the right coronary artery (RCA), then the coronary circulation can be classified as \"right-dominant.\" If the posterior descending artery is supplied by the circumflex artery (CX), a branch of the left artery, then the coronary circulation can be classified as \"left-dominant.\" If the posterior descending artery is supplied by both the right coronary artery and the circumflex artery, then the coronary circulation can be classified as \"co-dominant.\"</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Isovolumetric relaxation is defined as?", "options": [{"label": "A", "text": "Relaxation of both atria", "correct": false}, {"label": "B", "text": "Relaxation of both atria with all valves open", "correct": false}, {"label": "C", "text": "Relaxation of LV with mitral and aortic valve closed", "correct": true}, {"label": "D", "text": "Relaxation of LV with mitral and aortic valve open", "correct": false}], "correct_answer": "C. Relaxation of LV with mitral and aortic valve closed", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Relaxation of LV with mitral and aortic valve closed Isovolumic relaxation time is an interval in the cardiac cycle, from the aortic component of the second heart sound, that is, closure of the aortic valve, to onset of filling by opening of the mitral valve . It can be used as an indicator of diastolic dysfunction.</p>\n<p><strong>Highyeild:</strong></p><p>Once the ventricular muscle is fully contracted, the already falling ventricular pressures drop more rapidly. This is the period of Protodiastole, which lasts about 0.04 s. It ends when the momentum of the ejected blood is overcome and the aortic and pulmonary valves close. After the valves are closed, pressure continues to drop rapidly during the period of isovolumetric ventricular relaxation. Isovolumetric relaxation ends when the ventricular pressure falls below the atrial pressure and the AV valves open, permitting the ventricles to fill. Filling is rapid at first, then slows as the next cardiac contraction approaches. Atrial pressure continues to rise after the end of ventricular systole until the AV valves open, then drops and slowly rises again until the next atrial systole.</p>\n<p><strong>Extraedge:</strong></p><p>Isovolumetric contraction - period between mitral valve closing and aortic valve opening; period of highest Or consumption. Isovolumetric relaxation - period between aortic valve closing and mitral valve opening. Systolic ejection - period between aortic valve opening and closing. Rapid Filing - period just after mitral valve opening. Reduced filling - period just before mitral valve closing.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "During mild to moderate exercise, increase in heart rate decreases the cardiac cycle time. The change that is most commonly seen is?", "options": [{"label": "A", "text": "There is greater decrease in atrial systole than in atrial diastole", "correct": false}, {"label": "B", "text": "There is greater decrease in ventricular systole than ventricular diastole", "correct": false}, {"label": "C", "text": "There is greater decrease in ventricular diastole than ventricular systole", "correct": true}, {"label": "D", "text": "None of the above", "correct": false}], "correct_answer": "C. There is greater decrease in ventricular diastole than ventricular systole", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>There is greater decrease in ventricular diastole than ventricular systole Increasing Heart Rate decreases the duration of Cardiac Cycle.</p>\n<p><strong>Highyeild:</strong></p><p>When heart rate increases, the duration of each cardiac cycle decreases, including the contraction and relaxation phases. The duration of the action potential and the period of contraction (systole) also decrease, but not by as great a percentage as does the relaxation phase (diastole). Because if diastole is compromised then ventricular filling is compromised. At a normal heart rate of 72 beats/min, systole comprises about 0.4 of the entire cardiac cycle. At three times the normal heart rate, systole is about 0.65 of the cycle.</p>\n<p><strong>Random:</strong></p><p>Explanation for other options: - Rest other options are incorrect because during exercise increases left ventricular stroke volume by enhancing intrinsic cardiac contractility (decreased end-systolic volume and increased ejection fraction) and improving left ventricular filling (increased end-diastolic volume).</p>\n<p><strong>Extraedge:</strong></p><p>Explanation for incorrect Options:- Rest other options are incorrect because during exercise increases left ventricular stroke volume by enhancing intrinsic cardiac contractility (decreased end-systolic volume and increased ejection fraction) and improving left ventricular filling (increased end-diastolic volume).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "During the cardiac cycle, when does the highest coronary blood flow per gram of left ventricular myocardium occur?", "options": [{"label": "A", "text": "When aortic pressure is highest", "correct": false}, {"label": "B", "text": "When left ventricular pressure is highest", "correct": false}, {"label": "C", "text": "At the beginning of isovolumic contraction", "correct": false}, {"label": "D", "text": "At the beginning of diastole", "correct": true}], "correct_answer": "D. At the beginning of diastole", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>At the beginning of diastole Blood flow through the coronary vessels of the left ventricle is determined by the ratio of perfusion pressure to vascular resistance. The perfusion pressure is directly related to the aortic pressure at the ostia of the coronaries.</p>\n<p><strong>Highyeild:</strong></p><p>Myocardial vascular resistance is significantly influenced by the contractile activity of the ventricle. During systole, when the ventricle is contracting, vascular resistance increases substantially. Flow is highest just at the beginning of diastole because, during this phase of the cardiac cycle, aortic pressure is still relatively high and vascular resistance is low due to the fact that the coronary vessels are no longer being squeezed by the contracting myocardium.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 27 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "An 82-year-old woman was admitted to the hospital with ascites, peripheral edema, and shortness of breath. Cardiac catheterization was ordered and the following values were obtained: Pulmonary artery O2 content = 20 mL/100 mL Pulmonary vein O2 content = 12 mL/100 mL Oxygen consumption = 280 mL/min Stroke volume = 40 mL. What is the woman’s cardiac output?", "options": [{"label": "A", "text": "2.86 L/min", "correct": false}, {"label": "B", "text": "3.5 L/min", "correct": true}, {"label": "C", "text": "7.0 L/min", "correct": false}, {"label": "D", "text": "8 mL/100 mL", "correct": false}], "correct_answer": "B. 3.5 L/min", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>3.5 L/min CO = V O 2/a-vO2 280 mL/min = 20 mL/100 mL − 12 mL/100 mL 280 mL/min = 8 mL/100 mL = 280 mL/min × 100 mL/8 mL = 3500 mL/min = 3.5 L/min</p>\n<p><strong>Highyeild:</strong></p><p>Cardiac output can be measured by using Fick’s principle, which asserts that the rate of uptake of a substance by the body (e.g., O2 consumption in milliliters per minute) is equal to the difference between its concentrations (milliliters per liter of blood) in arterial and venous blood multiplied by the rate of blood flow (cardiac output). This principle is restricted to situations in which arterial blood is the only source of the substance measured. If oxygen consumption by the body at a steady state is measured over a period of time and the difference in arterial O2 and venous O2 is measured by sampling arterial blood and pulmonary arterial blood (which is fully mixed venous blood), cardiac output is obtained from the expression</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Other calculations are incorrect, so the answer is Option B 3.5 liters.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 48-year-old woman regularly goes for a walk and exercises early in the morning. But for the last few months, she was noticing that she felt breathlessness upon exertion. She went to a local physician for her concern. Her vitals were taken and ECG was done. On ECG it was revealed that she had a heart block. She was then referred to a cardiologist and he told her that a procedure to implant a pacemaker will be carried out. Before the procedure, the following data was collected- Heart rate- 70/ min Left ventricular end-diastolic volume- 130 ml Left ventricular end-systolic volume- 60 ml Right atrial pressure- 4 mm hg From the above scenario, what will be the cardiac output of the patient?", "options": [{"label": "A", "text": "3 liters/min", "correct": false}, {"label": "B", "text": "3.4 liters/min", "correct": false}, {"label": "C", "text": "4 liters/min", "correct": false}, {"label": "D", "text": "4.4 liters /min", "correct": true}], "correct_answer": "D. 4.4 liters /min", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>4.4 liters /min Cardiac output- stroke volume X heart rate Stroke volume= EDV-ESV That is- (130-60)= 70 ml So the cardiac output will be 70×70= 4400 ml/min- 4.4 liters/min So the correct answer is D.</p>\n<p><strong>Highyeild:</strong></p><p>Cardiac Output Equations:</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- The rest of other options are false.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Preload is the stretching of the cardiac muscle fibers at the end of diastole, just before contraction. It is due to an increase in ventricular pressure caused by the filling of blood during diastole. An image is provided below that further supplements the findings stated above. These are expressions of?", "options": [{"label": "A", "text": "Frank starling’s law", "correct": true}, {"label": "B", "text": "Vascular hyalinosis", "correct": false}, {"label": "C", "text": "Vascular capacitance", "correct": false}, {"label": "D", "text": "Vascular resistance", "correct": false}], "correct_answer": "A. Frank starling’s law", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Frank starling’s law The Frank– Starling law of the heart (also known as Starling's law and the Frank–Starling mechanism) represents the relationship between stroke volume and end-diastolic volume. The law states that the stroke volume of the heart increases in response to an increase in the volume of blood in the ventricles, before contraction (the end-diastolic volume). When all other factors remain constant.</p>\n<p><strong>Highyeild:</strong></p><p>Starling curves:- The force of contraction is proportional to the end-diastolic length of cardiac muscle fiber (preload). ↑ contractility with catecholamines, and positive inotropes (eg, dobutamine, milrinone, digoxin). ↓ contractility with loss of functional myocardium (eg, MI), B-blockers (acutely), non dihydropyridine Ca2+ channel blockers, HF.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: B. Vascular hyalinosis, refers to the thickening of the walls of vessels by the deposits that appear as homogeneous pink hyaline material in r outine staining. Option: C. Vascular capacitance, The measure of a BLOOD VESSEL’s ability to increase the volume of BLOOD it holds without a large increase in BLOOD PRESSURE. Option: D. Vascular resistance, the amount of force exerted on circulating blood by the vasculature of the body.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A male person at the age of 76 years was escorted to the emergency ward with difficulty in breathing, nausea, and restlessness after one hour. On examination, pulse rate was 139/min irregularly irregular, blood pressure 105/95 mm of Hg, and RR 26/min. His jugular vein pressure was elevated, and his carotid upstrokes were delayed. Chest examination on auscultation reported rates bilaterally. His cardiac exam reveals a grade III/VI late peaking systolic ejection murmur with a normal first heart sound and a single second heart sound. The patient exhibited edema of +1 grade on extremities. Select the correct heart rhythm:", "options": [{"label": "A", "text": "Normal sinus rhythm", "correct": false}, {"label": "B", "text": "Atrial fibrillation", "correct": true}, {"label": "C", "text": "Sinus rhythm with Mobitz I (Wenckebach) A-V block", "correct": false}, {"label": "D", "text": "Re-entry-induced paroxysmal atrial tachycardia", "correct": false}], "correct_answer": "B. Atrial fibrillation", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Atrial fibrillation Atrial fibrillation is an abnormal heart rhythm (arrhythmia) characterized by rapid and irregular beating of the atrial chambers of the heart. It often begins as short periods of abnormal beating, which become longer or continuous over time. It may also start as other forms of arrhythmia such as atrial flutter that then transform into AF.</p>\n<p><strong>Highyeild:</strong></p><p>Atrial fibrillation can be distinguished from atrial flutter (AFL), which appears as an organized electrical circuit usually in the right atrium. AFL produces characteristic saw-toothed F-waves of constant amplitude and frequency on an ECG, whereas AF does not. In AFL, the discharges circulate rapidly at a rate of 300 beats per minute (bpm) around the atrium. In AF, there is no such regularity, except at the sources where the local activation rate can exceed 500 bpm. Although AF and atrial flutter are distinct arrhythmias, atrial flutter may degenerate into AF, and an individual may experience both arrhythmias at different times.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Atrial fibrillation doesn't show Normal sinus rhythm. Option: C. Mobitz type I is a type of 2nd-degree AV block, which refers to an irregular cardiac rhythm (arrhythmia). Option: D. Paroxysmal supraventricular tachycardia (PSVT) is a type of abnormal heart rhythm or arrhythmia. It occurs when a short circuit rhythm develops in the upper chamber of the heart.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Preload is the amount of sarcomere stretch experienced by cardiac muscle fibers at the end of the ventricular filling during diastole. As the relaxed ventricle fills during diastole, the walls are stretched and the length of sarcomeres increases. Sarcomere length can be approximated by the volume of the ventricle, because each shape has a conserved surface-area-to-volume ratio. Select the correct for left ventricular preload?", "options": [{"label": "A", "text": "The amount of volume filling the left ventricle", "correct": true}, {"label": "B", "text": "The LV wall tension during systole", "correct": false}, {"label": "C", "text": "The diastolic wall radius of the LV", "correct": false}, {"label": "D", "text": "The LV wall tension at end-diastole", "correct": false}], "correct_answer": "A. The amount of volume filling the left ventricle", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The amount of volume filling the left ventricle The amount of volume filling the left ventricle is left ventricular preload. Preload is directly related to ventricular filling.</p>\n<p><strong>Highyeild:</strong></p><p>The decrease in left ventricular preload may result exclusively from a decreased systemic venous return due to increased pleural pressure, or from an additional effect such as, decreased left ventricular compliance. More precise than preload, its end-diastolic volume is better suited to the clinic. It is relatively straightforward to estimate the volume of a healthy, filled left ventricle by visualizing the 2D cross-section with cardiac ultrasound.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest all options are incorrect because Preload is directly related to ventricular filling.</p>\n<p><strong>Extraedge:</strong></p><p>Preload Preload approximated by ventricular end- diastolic volume (EDV); depends on venous tone and circulating blood volume. Afterload Afterload approximated by MAP. .↑ wall tension per Laplace's law →↑ pressure →↑afterload. LV compensates for ↑afterload by thickening (hypertrophy) in order to ↓wall stress.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 58-year-old male patient presents to the hospital with chest pressure of two hours duration, which radiates to his left arm. On examination, his heart rate is 115 and regular, his blood pressure is 165/85, he appears pale and shortness of breath. His electrocardiogram reveals ST segment elevation in the anterior leads, with reciprocal ST depression in the inferior leads. If this patient developed myocardial rupture several days later, select the correct option?", "options": [{"label": "A", "text": "Muffled heart sounds", "correct": false}, {"label": "B", "text": "Pulsus paradoxus", "correct": false}, {"label": "C", "text": "Elevation of jugular venous pressure", "correct": false}, {"label": "D", "text": "All of the above are correct", "correct": true}], "correct_answer": "D. All of the above are correct", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>All of the above are correct The most common cause of myocardial rupture is a recent myocardial infarction, with the rupture typically occurring three to five days after infarction.</p>\n<p><strong>Highyeild:</strong></p><p>Other causes of rupture include cardiac trauma, endocarditis (infection of the heart), cardiac tumors, infiltrative diseases of the heart, and aortic dissection. Risk factors for rupture after an acute myocardial infarction include female gender, the advanced age of the individual, first ischemic event, and a low body mass index. Other presenting signs associated with myocardial rupture include a pericardial friction rub, sluggish flow in the coronary artery after it is opened i.e. revascularized with angioplasty, the left anterior descending artery being often the cause of the acute MI, and delay of revascularization greater than 2 hours.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Muffled heart sounds are a common sign of cardiac tamponade , which can occur as a result of myocardial rupture. Option: B. Pulsus paradoxus, a decrease in blood pressure during inspiration, can also be seen in cardiac tamponade . Option: C. Myocardial rupture can lead to cardiac tamponade , which is characterized by an accumulation of fluid in the pericardial sac around the heart. This can cause an elevation in jugular venous pressure due to impaired filling of the right ventricle .</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A female patient of 49 years with a history of hypertension and high cholesterol came to the hospital with chest pain and an electrocardiogram found to have ST-segment elevation in the inferior leads, with reciprocal ST depressions in the anterior leads. On examination, the patient is pale and sweaty and has a blood pressure of 85/55 mm Hg. The jugular veins are distended to an estimated pressure of 15 mm Hg. The X-ray of the chest showed no abnormality in the lungs. Select the correct?", "options": [{"label": "A", "text": "Cardiac tamponade", "correct": false}, {"label": "B", "text": "Acute ventricular septal defect", "correct": false}, {"label": "C", "text": "Acute papillary muscle rupture", "correct": false}, {"label": "D", "text": "Right ventricular infarction", "correct": true}], "correct_answer": "D. Right ventricular infarction", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Right ventricular infarction The principal cause of right ventricular infarction is atherosclerotic proximal occlusion of the right coronary artery. Proximal occlusion of this artery leads to electrocardiographically identifiable right-heart ischemia and an increased risk of death in the presence of acute inferior infarction.</p>\n<p><strong>Highyeild:</strong></p><p>Clinical recognition begins with the ventricular electrocardiographic manifestations: inferior left ventricular ischemia (ST-segment elevation in leads II, III, and a VF) Hemodynamic effects of right ventricular dysfunction may include failure of the right ventricle to pump sufficient blood through the pulmonary circuit to the left ventricle, with consequent systemic hypotension.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Cardiac tamponade. An aortic dissection may lead to hemopericardium, when blood dissects through the media proximally. Such a massive amount of hemorrhage can lead to cardiac tamponade. Option: B. A ventricular septal defect (VSD) is an abnormal communication between the left and right ventricle through a defect in the septal wall of the heart. VSD is a lethal complication of myocardial infarction (MI). Option: C. Ventricular papillary muscle rupture patients usually present with symptoms of acute heart failure including severe dyspnea, orthopnea, and hypoxia in the immediate post-myocardial infarction.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A male of 48 years presented with H/O hypertension, raised cholesterol, and occasional chest pain. The electrocardiogram is found to have ST-segment elevation in the inferior leads, with reciprocal ST depressions in the anterior leads. Examination reported pallor, sweating, and blood pressure of 90/60 mm Hg. Lung fields are clear in the X-ray of the chest. Select the incorrect?", "options": [{"label": "A", "text": "Left ventricular end-diastolic pressure to be high", "correct": false}, {"label": "B", "text": "Kussmaul's sign present", "correct": false}, {"label": "C", "text": "Anterior portion of the left ventricle to be hypokinetic", "correct": false}, {"label": "D", "text": "Pulmonary capillary wedge pressure to be reduced", "correct": true}], "correct_answer": "D. Pulmonary capillary wedge pressure to be reduced", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Pulmonary capillary wedge pressure to be reduced Elevated levels of PCWP might indicate severe left ventricular failure or severe mitral stenosis.</p>\n<p><strong>Highyeild:</strong></p><p>' Left ventricular end-diastolic pressure (LVEDP) is an important measure of ventricular performance and may identify patients at increased risk of developing late clinical symptoms of heart failure (HF) Left ventricular end-diastolic pressure (LVEDP) is a reflection of ventricular compliance and intravascular volume and pressure; it relates both acutely and chronically to clinical conditions that affect ventricular performance. Following acute myocardial infarction (AMI), LVEDP may be elevated in association with larger infarct size and increased circulatory volume; it may also reflect underlying comorbid cardiac diseases.</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Rest options are correct only Option D is incorrect because Pulmonary capillary wedge pressure is to be increased not reduced.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 33-year-old patient presented with symptoms of breathlessness, weakness, lethargy, occasional chest pain on activity, and loss of appetite over several months. Examination and ECG were conducted. The physician noted S4 loudest at the apex with the patient in the left lateral decubitus position. Select the incorrect?", "options": [{"label": "A", "text": "Atrial gallop", "correct": false}, {"label": "B", "text": "Ventricular hypertrophy or myocardial ischemia", "correct": false}, {"label": "C", "text": "Heard in late diastole and is caused by atrial contraction against a stiffened ventricle", "correct": false}, {"label": "D", "text": "Atrial stenosis", "correct": true}], "correct_answer": "D. Atrial stenosis", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Atrial stenosis S4 heart sound, also known as an atrial gallop, is heard in late diastole and is caused by atrial contraction against a stiffened ventricle. It is usually indicative of ventricular hypertrophy or myocardial ischemia, which causes the ventricle to become stiff and less compliant. Atrial stenosis, on the other hand, is a narrowing of the opening between the atria, which can cause blood to back up into the lungs and lead to symptoms such as shortness of breath and fatigue. It typically causes a mid-diastolic murmur and not an S4 heart sound. Therefore, the correct option is D. Atrial stenosis is an incorrect statement in this scenario.</p>\n<p><strong>Highyeild:</strong></p><p>The fourth heart sound or S4 is an extra heart sound that occurs during late diastole, immediately before the normal two \"lub-dub\" heart sounds (S1 and S2). It occurs just after atrial contraction and immediately before the systolic S1 and is caused by the atria contracting forcefully to overcome an abnormally stiff or hypertrophic ventricle. This produces a rhythm classically compared to the cadence of the word \"Tennessee.\". One can also use the phrase \"A-stiff-wall\" to help with the cadence (a S4, stiff S1, wall S2), as well as the pathology of the S4 sound S4 has also been termed an atrial gallop or a presystolic gallop because of its occurrence late in the heart cycle. It is a type of gallop rhythm by virtue of having an extra sound; the other gallop rhythm is called S3. The two are quite different, but they may sometimes occur together forming a quadruple gallop. If the heart rate is also very fast (tachycardia), it can become difficult to distinguish between S3 and S4 thus producing a single sound called a summation gallop.</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Other options are correct except D Atrial stenosis.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 54-Year-old patient presented with occasional chest pain, breathlessness during activity, and chest heaviness. In clinical examination, the physician noted a protodiastolic gallop on auscultation. Select the incorrect?", "options": [{"label": "A", "text": "Protodiastolic gallop is a normal event in a healthy heart", "correct": true}, {"label": "B", "text": "Increase in the volume load on the ventricles", "correct": false}, {"label": "C", "text": "Valvular regurgitation, high-output states, left-to-right intracardiac shunts, complete A-V block", "correct": false}, {"label": "D", "text": "Ventricular dysfunction", "correct": false}], "correct_answer": "A. Protodiastolic gallop is a normal event in a healthy heart", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Protodiastolic gallop is a normal event in a healthy heart A Protodiastolic galloping sound on cardiac auscultation because of an abnormally audible third heart sound. In healthy adults, there are two normal heart sounds, often described as a lub and a dub that occur in sequence with each heartbeat . These are the first heart sound (S1) and second heart sound (S2), produced by the closing of the atrioventricular valves and semilunar valves, respectively.</p>\n<p><strong>Highyeild:</strong></p><p>The third heart sound (S3) is a low-frequency, brief vibration occurring in the early diastole at the end of the rapid diastolic filling period of the right or left ventricle. Synonymous terms include: ventricular gallop, early diastolic gallop, ventricular filling sound, and protodiastolic gallop.</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option: B. Protodiastolic gallop, Increase in the volume load on the ventricles Option: C. Valvular regurgitation, high-output states, left-to-right intracardiac shunts, complete A-V block shows protodiastolic gallop on auscultation. Option: D. Protodiastolic gallop on auscultation is also seen in Ventricular dysfunction.</p>\n<p><strong>Extraedge:</strong></p><p>Children and adults up to age 35 to 40 may have a normal third heart sound. The explanation for this \"physiologic S3,\" which is identical in timing, and frequency to its pathologic counterpart, is unknown. Before age 40, the significance of the third heart sound must be judged by the presence or absence of significant heart disease. After the age of 40, a third heart sound is usually abnormal and correlates with dysfunction or volume overload of the ventricles.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The cardiac cycle is the performance of the human heart from the beginning of one heartbeat to the beginning of the next. It consists of two periods: one during which the heart muscle relaxes and refills with blood, called diastole, following a period of robust contraction and pumping of blood, called systole. Select the incorrect regarding the diastolic phase of the cardiac cycle?", "options": [{"label": "A", "text": "Pressure in the two ventricles begins to rise to a peak", "correct": true}, {"label": "B", "text": "The mitral valve opens due to a negative pressure differential", "correct": false}, {"label": "C", "text": "The ratio of peak velocity blood flow from left ventricular relaxation in early diastole (the E wave) to peak velocity flow in late diastole caused by atrial contraction (the A wave)", "correct": false}, {"label": "D", "text": "Pressure in the two ventricles begins to drop from the peak", "correct": false}], "correct_answer": "A. Pressure in the two ventricles begins to rise to a peak", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Pressure in the two ventricles begins to rise to a peak Pressure in the two ventricles begins to drop from the peak not rise to the peak.</p>\n<p><strong>Highyeild:</strong></p><p>During early ventricular diastole, pressure in the two ventricles begins to drop from the peak reached during systole. When the pressure in the left ventricle falls below that in the left atrium, the mitral valve opens due to a negative pressure differential (suction) between the two chambers, causing blood in the atrium (accumulated during atrial diastole) to flow into the ventricle. Likewise, the same phenomenon runs simultaneously in the right ventricle and right atrium through the tricuspid valve. The ventricular filling flow (or flow from the atria into the ventricles) has an early (E) diastolic component caused by ventricular suction, and then a late one created by atrial systole (A). The E/A ratio is used as a diagnostic measure as its diminishment indicates probable diastolic dysfunction.</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option: B. The mitral valve opens due to a negative pressure differentia l, it’s the correct Option: C. It is the correct option because of the ratio of peak velocity blood flow from left ventricular relaxation in early diastole (the E wave) to peak velocity flow in late diastole caused by atrial contraction (the A wave). Option: D. Pressure in the two ventricles begins to drop from the peak not to rise.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A male person of age 26 years reported with shortness of breath, palpitation, chest pain, and weakness past 6 months. The ECG study reported the present findings as in the image Select the incorrect?", "options": [{"label": "A", "text": "Abnormal P wave, atrial systole begins at the P wave", "correct": false}, {"label": "B", "text": "Left atrial enlargement", "correct": false}, {"label": "C", "text": "Right atrial enlargement", "correct": true}, {"label": "D", "text": "Left atrial hypertension", "correct": false}], "correct_answer": "C. Right atrial enlargement", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683531966963-QTDY007012IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Right atrial enlargement The P wave on the ECG represents atrial depolarization , which results in atrial contraction, or atrial systole.</p>\n<p><strong>Highyeild:</strong></p><p>The P wave is a summation wave generated by the depolarization front as it transits the atria. Normally the right atrium depolarizes slightly earlier than the left atrium since the depolarization wave originates in the sinoatrial node, in the high right atrium and then travels to, and through the left atrium.</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option: A: ECG findings are Abnormal P wave, atrial systole begins at the P wave. Option: B: One of the signs of left atrial enlargement on an ECG is an unusual “P wave.” Option: D: One of the signs of left atrial enlargement on an ECG is an abnormal “P wave.”</p>\n<p><strong>Extraedge:</strong></p><p>P wave morphology with atrial enlargement in leads I, II, and V1. The P waves in left atrial enlargement (left panel) are wide (>0.12 sec) and notched in leads I and II and the terminal segment has a negative deflection that is deep and delayed in V1. In right atrial enlargement (middle panel), the P wave amplitude is increased (0.28 mV) in lead II. Biatrial enlargement (right panel) have characteristics of both atrial abnormalities: the P wave amplitude (0.22 mV) and duration (0.12 sec) are increased in lead II and there is deep terminal negativity in V1.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "In the atrial systole, the atria contract, and the pressure within the atrial chambers increases, which forces more blood flow across the open atrioventricular (AV) valves, leading to a rapid flow of blood into the ventricles. Select the incorrect feature in atrial systole?", "options": [{"label": "A", "text": "The ilking effect promotes the backward flow of blood from the atria into the vena cava leading to abnormal atrial systole", "correct": false}, {"label": "B", "text": "Atrial contraction produces a small increase in venous pressure which is interpreted as an \"a-wave\" of the left atrial pressure (LAP)", "correct": false}, {"label": "C", "text": "Atrial contraction normally accounts for about 10% of left ventricular filling when a person is at rest", "correct": false}, {"label": "D", "text": "Only A incorrect, and both B and C correct", "correct": true}], "correct_answer": "D. Only A incorrect, and both B and C correct", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Only A incorrect, and both B and C correct The incorrect feature in atrial systole is \"The ilking effect promotes the backward flow of blood from the atria into the vena cava leading to abnormal atrial systole.\" Atrial systole occurs late in ventricular diastole and represents the contraction of the myocardium of the left and right atria. The sharp decrease in ventricular pressure that occurs during ventricular diastole allows the atrioventricular valves (or mitral and tricuspid valves) to open and causes the contents of the atria to empty into the ventricles.</p>\n<p><strong>Highyeild:</strong></p><p>The atrioventricular valves remain open while the aortic and pulmonary valves remain closed because the pressure gradient between the atrium and ventricle is preserved during late ventricular diastole.</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- The other two statements, B and C, are correct. Atrial contraction produces a small increase in venous pressure, which is interpreted as an \"a-wave\" of the left atrial pressure (LAP), and normally accounts for about 10% of left ventricular filling when a person is at rest. Therefore, the correct answer is \"Only A is incorrect, and both B and C correct.\"</p>\n<p><strong>Extraedge:</strong></p><p>The \"ilking effect\" is a phenomenon in which the pressure in the great veins, particularly the inferior vena cava, rises during atrial systole due to the contraction of the atria. This increase in pressure can cause a small amount of blood to flow back from the atria into the vena cava, but it is a normal physiological response and not considered abnormal.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A male patient of 47 years reported to a cardiologist with symptoms of restlessness, sweating, difficulty in breathing on activity, and palpitation. The patient narrated H/O of angina pectoris after walking a long distance. ECG findings are given in the image as Select the incorrect?", "options": [{"label": "A", "text": "Atrial fibrillation", "correct": false}, {"label": "B", "text": "Irregularly spaced QRS complexes with abnormal P waves", "correct": true}, {"label": "C", "text": "Decrease cardiac output due to the absence/ineffectual atrial systole", "correct": false}, {"label": "D", "text": "Hypertension and Valvular heart defect are the risk factors of Atrial fibrillation", "correct": false}], "correct_answer": "B. Irregularly spaced QRS complexes with abnormal P waves", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683531967085-QTDY007014IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Irregularly spaced QRS complexes with abnormal P waves Atrial fibrillation is associated with irregularly spaced QRS complexes without P waves.</p>\n<p><strong>Highyeild:</strong></p><p>Absence of atrial systole. It is difficult to establish the precise contribution of atrial systole to ventricular function because this depends, in part, upon filling pressures. In a group of patients with complete heart block, the mean cardiac index decreased from 2.7 1/min per square meter during correct atrioventricular sequencing to 2.3 1/ min during ventricular pacing, Thus, the absence of atrial systole reduces cardiac output although this alone does not appear to explain the full extent of impairment of cardiac function seen in atrial fibrillation. This suggests that both the rate and the irregularity of the ventricular response also contribute to the hemodynamic changes seen in atrial fibrillation</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option: A. Atrial fibrillation is the diagnosis of this because ECG shows irregularly spaced QRS complexes without P waves. Option: C. Cardiac output decreases because of the absence of atrial systole. Option: D. High blood pressure and valvular heart disease are the most common modifiable risk factors for AF.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "In cardiovascular physiology, end-diastolic volume (EDV) is the volume of blood in the right and/or left ventricle at end load or filling in (diastole) or the amount of blood in the ventricles just before systole. Because greater EDVs cause greater distention of the ventricle. Select the incorrect statement?", "options": [{"label": "A", "text": "Essential parameter for the assessment of stroke volume and ejection fraction", "correct": false}, {"label": "B", "text": "It depicts left or right ventricular preload", "correct": false}, {"label": "C", "text": "It describes the ventricular afterload", "correct": true}, {"label": "D", "text": "In adult women, EDV is 70-155 mL, while in adult men, EDV is 83-207 mL", "correct": false}], "correct_answer": "C. It describes the ventricular afterload", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>It describes the ventricular afterload Increasing EDV will increase the load on the ventricle even before the contraction starts. Hence it is called Preload.</p>\n<p><strong>Highyeild:</strong></p><p>End-diastolic volume (EDV) is the volume of blood in the right and/or left ventricle at end load or filling in (diastole) or the amount of blood in the ventricles just before systole. Because greater EDVs cause greater distention of the ventricle, EDV is often used synonymously with preload, which refers to the length of the sarcomeres in cardiac muscle before contraction (systole). An increase in EDV increases the preload on the heart and, through the Frank-Starling mechanism of the heart, increases the amount of blood ejected from the ventricle during systole (stroke volume). Increasing EDV will increase the load on the ventricle even before the contraction starts. Hence it is called Preload. EDV Depends on Ventricular compliance and Venous Return. EDV Normal Range is 120-130ml</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "An adult female of 34 years reported shortness of breath, chest pain on exertion, loss of appetite, weakness, and giddiness in the past year. A clinical examination was conducted. The ECG findings are provided in the image: Select the correct option?", "options": [{"label": "A", "text": "End diastolic volume raised", "correct": false}, {"label": "B", "text": "Ventricles enlarged", "correct": false}, {"label": "C", "text": "Activation of the sympathetic nervous system and the renin-angiotensin system", "correct": false}, {"label": "D", "text": "All of the above options are correct", "correct": true}], "correct_answer": "D. All of the above options are correct", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683531967123-QTDY007016IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>All of the above options are correct ECG of a young patient with dilated cardiomyopathy. inferior Q waves (II, III, and aVF), poor R wave progression across the precordial leads with deep S waves in V1 – V3, and a single premature ventricular complex. High-degree AV block is also present.</p>\n<p><strong>Highyeild:</strong></p><p>In cardiovascular physiology, end-diastolic volume (EDV) is the volume of blood in the right and/or left ventricle at end load or filling in (diastole) or the amount of blood in the ventricles just before systole. Because greater EDVs cause greater distention of the ventricle, EDV is often used synonymously with preload. Dilated cardiomyopathy (DCM) is a condition in which the heart becomes enlarged and cannot pump blood effectively. It is linked to increased end-diastolic</p>\n<p><strong>Extraedge:</strong></p><p>The electrocardiogram (ECG) findings in a young patient with dilated cardiomyopathy may vary depending on the severity of the disease and other individual factors. However, some common ECG findings that may be observed in dilated cardiomyopathy include: Sinus tachycardia: Dilated cardiomyopathy can cause a decrease in cardiac output, which can lead to an increase in heart rate to compensate for the decreased stroke volume. Left bundle branch block (LBBB): LBBB is a common finding in patients with dilated cardiomyopathy and is associated with a poor prognosis. Prolonged QRS duration: The QRS duration may be prolonged in patients with dilated cardiomyopathy due to delayed ventricular activation. ST-T wave abnormalities: Abnormalities in the ST-T wave, such as T-wave inversion, ST-segment depression, or elevation, may be observed in patients with dilated cardiomyopathy. Atrial fibrillation: Dilated cardiomyopathy can increase the risk of atrial fibrillation, which may be detected on the ECG as an irregularly irregular rhythm with absent P waves.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A male patient aged 54 years reported to a physician with the symptoms of fatigue, bloating sensation in the stomach, palpitations in the chest, loss of appetite, and nausea in the past 3 months. The patient reported difficulty in breathing after work. Clinical examination, ECG, and lab tests were conducted. The image below depicts the ECG findings of the patient who reported with the clinical manifestations cited above. Select the incorrect?", "options": [{"label": "A", "text": "Improvement in rapid ejection and slow ejection phases in a cardiac cycle", "correct": true}, {"label": "B", "text": "Poor prognosis in patients with CHF", "correct": false}, {"label": "C", "text": "Reduced contractility of ventricles", "correct": false}, {"label": "D", "text": "Central measure of left ventricular systolic function", "correct": false}], "correct_answer": "A. Improvement in rapid ejection and slow ejection phases in a cardiac cycle", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683531969274-QTDY007017IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Improvement in rapid ejection and slow ejection phases in a cardiac cycle ECG findings depict poor ejection fraction indication, poor contractility of ventricles, and reduced effective circulatory blood volume.</p>\n<p><strong>Highyeild:</strong></p><p>Low left ejection fraction indicates poor prognosis for patients with AMI, Angina pectoris, and CHF. Ejection fraction is the measure of left ventricular systolic function. Left ventricular ejection fraction (LVEF) is the central measure of left ventricular systolic function. LVEF is the fraction of chamber volume ejected in systole (stroke volume) in relation to the volume of the blood in the ventricle at the end of diastole (end-diastolic volume). LVEF (%) among the male population: 52% to 72% normal range 41% to 51 mildly abnormal LVEF (%) among the female population: 54% to 74% normal range 41% to 53 mildly abnormal In the rapid ejection phase, This phase represents the initial, rapid ejection of blood into the aorta and pulmonary arteries from the left and right ventricles, respectively. Ejection begins when the intraventricular pressures exceed the pressures within the aorta and pulmonary artery, which causes the aortic and pulmonic valves to open. Blood is ejected because the total energy of the blood within the ventricle exceeds the total energy of blood within the aorta.</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option: A. Patients with CHF have a Poor prognosis. Option: C. Reduced Ejection fraction because of decreased contractility of ventricles. Option: D. Left ventricular ejection fraction (LVEF) is the central measure of left ventricular systolic function.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "During ventricular systole, the ventricles are contracting and vigorously pulsing (or ejecting) two separated blood supplies from the heart, one to the lungs and one to all other body organs and systems. The two atria are relaxed (atrial diastole). This precise coordination ensures that blood is efficiently collected and circulated throughout the body. In the experimental study, physiologists reported a delay between atrial systole and the initiation of ventricular systole. The duration of delay was 0.09s. Select the incorrect statement?", "options": [{"label": "A", "text": "Delayed and reduced contractility of ventricles", "correct": true}, {"label": "B", "text": "AV delay", "correct": false}, {"label": "C", "text": "Allows the atria to complete contracting before the ventricles are depolarized.", "correct": false}, {"label": "D", "text": "When the ventricle starts to contract, the pressure exceeds that of the corresponding atrium, resulting in the closure of the atrioventricular valves", "correct": false}], "correct_answer": "A. Delayed and reduced contractility of ventricles", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Delayed and reduced contractility of ventricles The statement in the question stem mentions a delay between atrial systole and the initiation of ventricular systole, which refers to the AV delay. This delay allows the atria to complete contracting before the ventricles are depolarized, ensuring efficient blood collection and circulation. The atrioventricular node delays impulses by approximately 0.09s. This delay in the cardiac pulse is extremely important: It ensures that the atria have ejected their blood into the ventricles first before the ventricles contract.</p>\n<p><strong>Highyeild:</strong></p><p>Normal AV Delay: When atrioventricular (AV) conduction is normal, mitral E and A waves are distinct (not fused) and A wave ends shortly (about 40-60 msec) before the onset of the next QRS on the ECG The AV node then \"gathers\" that electrical impulse and, after a brief delay, allows it to pass through to the ventricles. This brief delay in the transmission of the electrical signal through the AV node is critical to a normal heartbeat and the efficient functioning of the heart.</p>\n<p><strong>Extraedge:</strong></p><p>The delay does not indicate reduced contractility of the ventricles, which would result in a reduced ejection of blood. When the ventricle starts to contract, the pressure exceeds that of the corresponding atrium, resulting in the closure of the atrioventricular valves, preventing backflow of blood into the atria.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Lymph flow from the foot is:", "options": [{"label": "A", "text": "Increased when an individual rises from the supine to a standing position", "correct": false}, {"label": "B", "text": "Increased by massaging the foot", "correct": false}, {"label": "C", "text": "Increased when capillary permeability is decreased", "correct": false}, {"label": "D", "text": "Decreased when the valves of the leg veins are incompetent", "correct": true}], "correct_answer": "D. Decreased when the valves of the leg veins are incompetent", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Decreased when the valves of the leg veins are incompetent The lymphatic system is responsible for draining excess interstitial fluid and returning it to the bloodstream. Lymphatic vessels have one-way valves that prevent the backflow of lymph fluid. When these valves are incompetent, the flow of lymph from the foot and leg is decreased, leading to lymphedema, a condition characterized by swelling and accumulation of lymph fluid.</p>\n<p><strong>Highyeild:</strong></p><p>Lymphatic vessels can be divided into two types: initial lymphatics and collecting lymphatics. The former lack valves and smooth muscle in their walls, and they are found in regions such as the intestine or skeletal muscle. Tissue fluid appears to enter them through loose junctions between the endothelial cells that form their walls. The fluid in them apparently is massaged by muscle contractions of the organs, contraction of arterioles and venules, with which they are often associated. They drain into the collecting lymphatics, which have valves and smooth muscle in their walls, and contract in a peristaltic fashion, propelling the lymph along the vessels.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Options: A & B. Rising from a supine to a standing position and massaging the foot may increase blood flow, but they do not directly affect lymph flow. Option: C. Capillary permeability, which refers to the ability of small molecules to pass through the walls of capillaries, can affect the exchange of fluid and nutrients between the blood and surrounding tissues, but it does not directly impact lymph flow .</p>\n<p><strong>Extraedge:</strong></p><p>FACTORS INFLUENCING LYMPH FLOW: Increased production: Increasing hydrostatic pressure Increase in capillary surface Increase in capillary permeability: hypoxia, bradykinin, hydrogen ions, ADP, Histamine Factors aiding lymph flow: Presence of valves in the lymphatic vessels. Movement of muscles Increase in Lymph flow Pressure gradient Respiratory pump during inspiration Factors decreasing lymph flow: Obstruction of lymph flow: tumors; lymphadenopathy; Filariasis Incompetence of valves</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Cardiac output measured by thermodilution technique is unreliable in all of the following situations EXCEPT:", "options": [{"label": "A", "text": "Ventricular septal defect", "correct": false}, {"label": "B", "text": "Tricuspid regurgitation", "correct": false}, {"label": "C", "text": "Low cardiac output", "correct": true}, {"label": "D", "text": "Pulmonary regurgitation", "correct": false}], "correct_answer": "C. Low cardiac output", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Low cardiac output Cardiac output measured by thermodilution technique; is reliable.</p>\n<p><strong>Highyeild:</strong></p><p>Two methods of measuring output that are applicable to humans, in addition to Doppler combined with echocardiography, are the direct Fick’s method and the indicator dilution method. Fick’s principle states that the amount of a substance taken up by an organ (or by the whole body) per unit of time is equal to the arterial level of the substance minus the venous level (A-V difference) times the blood flow. This principle can be applied, of course, only in situations in which arterial blood is the sole source of the substance taken up. The principle can be used to determine cardiac output by measuring the amount of O2 consumed by the body in a given period and dividing this value by the A-V difference across the lungs. Because systemic arterial blood has effectively the same O2 content in all parts of the body, the arterial O2 content can be measured in a sample obtained from any convenient artery. A sample of venous blood in the pulmonary artery is obtained using a cardiac catheter. It has now become commonplace to insert a long catheter through a forearm vein and to guide its tip into the heart with the aid of a fluoroscope. To measure cardiac output by the “indicator dilution method,” a small amount of indicator, such as a dye, is injected into a large systemic vein or, preferably, into the right atrium. This indicator passes rapidly through the right side of the heart, then through the blood vessels of the lungs, through the left side of the heart, and, finally, into the systemic arterial system. The concentration of the dye is recorded as the dye passes through one of the peripheral arteries. A popular indicator dilution technique is thermodilution, in which the indicator used is cold saline. The saline is injected into the right atrium through one channel of a double-lumen catheter, and the temperature change in the blood is recorded in the pulmonary artery, using a thermistor in the other, longer side of the catheter. The temperature change is inversely proportional to the amount of blood flowing through the pulmonary artery; that is, to the extent that the cold saline is diluted by blood. This technique has two important advantages: The saline is completely innocuous. The cold is dissipated in the tissues so recirculation is not a problem, and it is easy to make repeated determinations.</p>\n<p><strong>Extraedge:</strong></p><p>Measurement of Cardiac Output: Fick’s Law : CO = Total body O2 Consumption per minute/ arteriovenous oxygen difference. Echo : Ultrasound of heart, Record all volumes. Dye dilution method : CO = Amount of Dye/ Concentration X Time. Thermodilution : Calculate CO from Temperature Change. Note:- Dilution methods are not accurate if shunts/ fistula/ regurgitation are present.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "During the examination, the doctor performs auscultation to assess the functioning of the patient’s mitral valve. Where can the sound of this valve be auscultated?", "options": [{"label": "A", "text": "At the edge of the sternum in the 2nd intercostal space on the right", "correct": false}, {"label": "B", "text": "At the edge of the sternum over the 5th costal cartilage on the right", "correct": false}, {"label": "C", "text": "At the apex of the heart", "correct": true}, {"label": "D", "text": "At the edge of the sternum in the 2nd intercostal space on the left", "correct": false}], "correct_answer": "C. At the apex of the heart", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>At the apex of the heart When the ventricles contract, one first hears a sound caused by the closure of the A-V valves. The mitral valve is located between the left atrium and left ventricle of the heart. Its closure creates the first heart sound (S1), which can be heard best at the apex of the heart, which is located at the 5th intercostal space in the mid-clavicular line on the left side of the chest.</p>\n<p><strong>Highyeild:</strong></p><p>The vibration is low in pitch and relatively long-lasting and is known as the first heart sound. The mitral area is over the apex of the left ventricle, which is the portion of the heart nearest the surface of the chest. Auscultation at the edge of the sternum in the 2nd intercostal space on the right is where the aortic valve can be heard, while the edge of the sternum over the 5th costal cartilage on the right is where the tricuspid valve can be heard.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 31 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A 42-year-old woman with mitral prolapse is admitted to the hospital for evaluation of her cardiac function. Which of the following values is the best index of the preload on her heart?", "options": [{"label": "A", "text": "Blood volume", "correct": false}, {"label": "B", "text": "Central venous pressure", "correct": false}, {"label": "C", "text": "Pulmonary capillary wedge pressure", "correct": false}, {"label": "D", "text": "Left ventricular end-diastolic volume", "correct": true}], "correct_answer": "D. Left ventricular end-diastolic volume", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Left ventricular end-diastolic volume The gold standard for measuring preload is LV end-diastolic volume.</p>\n<p><strong>Highyeild:</strong></p><p>Preload is the degree to which the myocardium is stretched before it contracts, i.e., the length of the sarcomere at the end of the diastole. In vivo, the variable most directly related to sarcomere length during end-diastole is left ventricular end-diastolic volume Although blood volume, central venous pressure, pulmonary capillary wedge pressure, and left ventricular end-diastolic pressure can all influence preload, they all exert their influence through changes in end-diastolic volume.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. The increase in blood volume leads to an increase in preload. Option: B. CVP is used as a measure of preload due to the directly proportional relationship between pressure and tension. Option: C. The pulmonary capillary wedge pressure (PWP) is the index of left ventricular filling pressure utilized as left ventricular preload.</p>\n<p><strong>Extraedge:</strong></p><p>Factors that affect preload include venous return, atrial contraction, heart rate, resistance from valves, and ventricular compliance.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A postlaminectomy patient suddenly stands up after being supine for 8 hours. As a result, which of the following hemodynamic variables will increase?", "options": [{"label": "A", "text": "End-diastolic volume", "correct": false}, {"label": "B", "text": "Renal blood flow", "correct": false}, {"label": "C", "text": "Venous return", "correct": false}, {"label": "D", "text": "Ejection fraction", "correct": true}], "correct_answer": "D. Ejection fraction", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Ejection fraction When a person rises suddenly, blood pools in the dependent portions of the body, causing decreases in venous return, left ventricular end-diastolic volume, stroke volume, and pulse pressure. The reduced stroke volume leads to a drop in cardiac output and, therefore, a drop in blood pressure. Decreased blood pressure produces the baroreceptor reflex, leading to an increase in sympathetic activity which increases heart rate and force of contraction, There is also increased total peripheral resistance. These changes in the cardiovascular system return blood pressure to</p>\n<p><strong>Highyeild:</strong></p><p>Cardiovascular MRI (CMR) is the gold standard for the calculation of left ventricular ejection fraction (LVEF). The ejection fraction (EF) is the fraction or percentage of blood that is ejected from the left ventricle (LV) during systole (contraction) compared to the amount of blood in the LV at the end of diastole (relaxation). It is a measure of the heart's pumping efficiency and is used to assess cardiac function.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest all of the above options reduced the hemodynamic variables on standing.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 48-year-old sedentary, obese male with the four-vessel coronary occlusive disease has a massive myocardial infarction while shoveling snow. In the blizzard conditions, it takes the ambulance over an hour to reach the man’s home. When the paramedics arrive, the patient’s radial pulse is rapid and thready, he has pink froth coming from his mouth, and he is nonresponsive. Increasing which of the following would lead to an increased stroke volume in cardiogenic shock?", "options": [{"label": "A", "text": "Heart rate", "correct": false}, {"label": "B", "text": "Venous compliance", "correct": false}, {"label": "C", "text": "Ventricular contractility", "correct": true}, {"label": "D", "text": "Total peripheral resistance", "correct": false}], "correct_answer": "C. Ventricular contractility", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Ventricular contractility Stroke volume is influenced by ventricular preload, afterload, and contractility.</p>\n<p><strong>Highyeild:</strong></p><p>Ventricular contractility refers to the strength of the heart muscle's contractions. Increasing ventricular contractility will improve the heart's ability to pump blood and thus increase stroke volume. In this scenario, the patient has suffered a massive myocardial infarction, which has significantly reduced ventricular contractility. Medications such as inotropic agents or positive inotropes can be used to improve ventricular contractility and thus increase stroke volume.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Decreasing total peripheral resistance may result in a decrease in afterload and therefore an increase in stroke volume. Decreasing ventricular compliance (making the heart stiffer) or increasing venous compliance will decrease ventricular filling and, therefore, preload and stroke volume. Similarly, increasing heart rate will decrease filling and stroke volume.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A patient comes to his physician complaining that he is no longer able to exercise as long as he used to. The physician auscultates crepitant rales and a third heart sound; blood pressure is normal. He sends the patient to cardiology to rule out heart failure. Which of the following is most consistent with a diagnosis of left heart failure?", "options": [{"label": "A", "text": "A decreased heart rate", "correct": false}, {"label": "B", "text": "An increased left ventricular wall stress", "correct": true}, {"label": "C", "text": "An increased left ventricular ejection fraction", "correct": false}, {"label": "D", "text": "A decreased left ventricular energy consumption", "correct": false}], "correct_answer": "B. An increased left ventricular wall stress", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>An increased left ventricular wall stress Increased left ventricular wall stress leads to left heart failure. An increased left ventricular wall stress indicates that the left ventricle is working harder than normal to pump blood, which can occur in left heart failure.</p>\n<p><strong>Highyeild:</strong></p><p>Left ventricular wall stress is the force acting against the myocardial cells. This is directly proportional to the left ventricular pressure and radius. Wall stress is indirectly proportional to two times the wall thickness. Biventricular heart failure Left, right failure; systolic/diastolic Cor pulmonale Heart failure secondary to any cause of pulmonary arterial hypertension Left-sided heart failure Impaired ability of the left ventricle to maintain adequate cardiac output without an increase in left-sided filling pressures Right-sided heart failure Impaired ability of the right ventricle to deliver blood flow to the pulmonary circulation and ↑ right atrial pressure</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Options A & D. A decreased heart rate and a decreased left ventricular energy consumption would not be consistent with left heart failure. Option C. An increased left ventricular ejection fraction may indicate a more efficient pumping of blood out of the left ventricle, which is not typically associated with left heart failure.</p>\n<p><strong>Extraedge:</strong></p><p>Pathophysiology of Left ventricular failure:- A clinical syndrome due to an alteration of structure and/or function of the left ventricle (LV) resulting in cardiac output, Pulmonary congestion, and ↓ peripheral perfusion Categorized according to left ventricular ejection fraction (LVEF) Systolic HF: LVEF ≤40 percent (HFREF Diastolic HF: preserved LVEF (HFPEF) ↓ cardiac output → backup of blood into left atrium → pulmonary circulation - ↑ pressure in pulmonary capillaries → pulmonary edema →↓ gas exchange, dyspnea Neurohormonal compensatory mechanisms RAAS and adrenergic activation → renal salt and water retention + vasoconstriction → ↑ contractility, ↑ circulating volume → ↑ CO, ↑ organ perfusion Adverse effects of compensation: ↑ afterload, ↑ LV workload, LV remodeling Natriuretic peptide secretion occurs in response to compensatory mechanisms and atrial stretch → diuresis, natriuresis, partial RAAS inhibition</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following is true concerning peripheral chemoreceptors?", "options": [{"label": "A", "text": "Activation is important in inhibiting the diving response", "correct": false}, {"label": "B", "text": "Activity is increased by increased pH", "correct": false}, {"label": "C", "text": "They are located in the medulla oblongata, but not the hypothalamus", "correct": false}, {"label": "D", "text": "Activation is important in the cardiovascular response to hemorrhagic hypotension", "correct": true}], "correct_answer": "D. Activation is important in the cardiovascular response to hemorrhagic hypotension", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Activation is important in the cardiovascular response to hemorrhagic hypotension Carotid bodies are the principal peripheral chemoreceptors for detecting changes in arterial blood oxygen levels, and the resulting chemoreflex is a potent regulator of blood pressure. Reflexes arising from the aortic bodies, which are located in the aortic arch, also regulate cardio-respiratory functions during Thus, carotid and aortic bodies are regarded as the major peripheral chemoreceptors for detecting arterial blood O2 levels and the ensuing reflexes maintain cardio-respiratory homeostasis during hypoxia and hypotension.</p>\n<p><strong>Highyeild:</strong></p><p>Peripheral arterial chemoreceptors in the carotid and aortic bodies are exposed to a very high rate of blood flow. These receptors are primarily activated by a reduction in arterial partial pressure of oxygen (PaO2), but they also respond to an increase in the arterial pressure of carbon dioxide (PaCO2) and pH. When the intracranial pressure is increased, the blood supply to the brain is compromised and Local Hypercapnia activates central chemoreceptors located along the ventrolateral medullary surface. Their activation induces a rise in systemic arterial pressure (Cushing reflex) that tends to restore the blood flow to the brain. The rise in BP causes a reflex decrease in heart rate via the arterial baroreceptors. This is why bradycardia and not tachycardia is seen in patients with Increased Intracranial Pressure: called Cushing’s reflex.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Activation of peripheral chemoreceptors can trigger the diving response , which is a reflex that helps conserve oxygen during underwater submersion. Option: B. Increased pH inhibits, rather than increases, peripheral chemoreceptor activity. Option: C. Peripheral chemoreceptors are not located in the medulla oblongata but in the carotid and aortic bodies . They are not located in the hypothalamus.</p>\n<p><strong>Extraedge:</strong></p><p>The classic Cushing response consists of a triad of clinical signs including increased systolic pressure/wide pulse pressure, bradycardia, and respiratory irregularity. Increased intracranial pressure leads to diminished perfusion pressure within the brain.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Systolic blood pressure is affected by:-", "options": [{"label": "A", "text": "Baroreceptors", "correct": false}, {"label": "B", "text": "Chemoreceptors", "correct": false}, {"label": "C", "text": "Venous return", "correct": false}, {"label": "D", "text": "All of the above", "correct": true}], "correct_answer": "D. All of the above", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>All of the above Systolic blood pressure is affected by Baroreceptors, Chemoreceptors, and Venous Return. The baroreceptors respond rapidly to changes in arterial pressure; in fact, the rate of impulse firing increases in a fraction of a second during each systole and decreases again during diastole. Furthermore, the baroreceptors respond much more to a rapidly changing pressure than to a stationary pressure. That is if the mean arterial pressure is 150 mm Hg but at that moment is rising rapidly, the rate of impulse transmission may be as much as twice that when the pressure is stationary at 150 mm Hg.</p>\n<p><strong>Highyeild:</strong></p><p>The signals transmitted from the chemoreceptors excite the vasomotor center, and this response elevates the arterial pressure back to However, this chemoreceptor reflex is not a powerful arterial pressure controller until the arterial pressure falls below 80 mm Hg. Therefore, it is at the lower pressures that this reflex becomes important to help prevent further decreases in arterial pressure. In the same way that the cardiac output curve relates the pumping of blood by the heart to right atrial pressure, the venous return curve relates venous return also to right atrial pressure—that is, the venous flow of blood into the heart from the systemic circulation at different levels of right atrial pressure.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following statements about the vasomotor center (VMC) is true?", "options": [{"label": "A", "text": "Independent of cortico-hypothalamic inputs", "correct": false}, {"label": "B", "text": "Influenced by baroreceptor signals but not by chemoreceptors", "correct": false}, {"label": "C", "text": "Acts along with the cardiac vagal center (CVC) to maintain blood pressure", "correct": true}, {"label": "D", "text": "Essentially silent in sleep", "correct": false}], "correct_answer": "C. Acts along with the cardiac vagal center (CVC) to maintain blood pressure", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Acts along with the cardiac vagal center (CVC) to maintain blood pressure The lateral portions of the vasomotor center transmit excitatory impulses through the sympathetic nerve fibers to the heart when there is a need to increase heart rate and contractility.</p>\n<p><strong>Highyeild:</strong></p><p>Conversely, when there is a need to decrease heart pumping, the medial portion of the vasomotor center sends signals to the adjacent dorsal motor nuclei of the vagus nerves, which then transmit parasympathetic impulses through the vagus nerves to the heart to decrease heart rate and heart contractility.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Independent of cortico-hypothalamic inputs -The hypothalamus plays a special role in controlling the vasoconstrictor system because it can exert powerful excitatory or inhibitory effects on the vasomotor center. The posterolateral portions of the hypothalamus cause mainly excitation, whereas the anterior portion can cause either mild excitation or inhibition, depending on the precise part of the anterior hypothalamus that is stimulated. Many parts of the cerebral cortex can also excite or inhibit the vasomotor Stimulation of the motor cortex, for instance, excites the vasomotor center because of impulses transmitted downward into the hypothalamus and then to the vasomotor center. Option: B. Influenced by baroreceptor signals but not by chemoreceptors-Stimulation of leptin receptors in these hypothalamic nuclei initiates multiple actions that decrease fat storage, including increased sympathetic nerve activity (through neural projections from the hypothalamus to the vasomotor centers), which increases metabolic rate and energy expenditure. The chemoreceptors excite nerve fibers that, along with the baroreceptor fibers, pass through Hering’s nerves and the vagus nerves into the vasomotor center of the brain stem. Option: D. Essentially silent in sleep- The vasomotor center (VMC) is a portion of the medulla oblongata in the brainstem, that, together with the cardiovascular center and respiratory center, regulates blood pressure and other homeostatic processes. It is not silent in sleep.</p>\n<p><strong>Extraedge:</strong></p><p>The vasomotor center (VMC): The VMC is present in the medulla oblongata and is composed of 2 centers: Vasoconstrictor center (VCC) present in the Pressor area of the medulla oblongata, Vasodilator center (VDC) present in the depressor area of the medulla oblongata. Vasomotor tone: This is continuous vasoconstrictor impulses sent by the vasomotor center (VMC) under normal level of ABP through sympathetic nerve fibers to the various arterioles to keep them in a state of moderate constriction. The vasomotor tone is important to maintain normal ABP. It is sympathetic vasoconstrictor tone.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The carotid sinus baroreceptors are most sensitive to?", "options": [{"label": "A", "text": "Systolic BP", "correct": false}, {"label": "B", "text": "Diastolic BP", "correct": false}, {"label": "C", "text": "Pulse pressure", "correct": false}, {"label": "D", "text": "Mean BP", "correct": true}], "correct_answer": "D. Mean BP", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Mean BP Baroreceptors are sensitive to the rate of pressure change besides the steady or mean pressure. Therefore, at a given mean arterial pressure, decreasing the pulse pressure (systolic minus diastolic pressure) decreases the baroreceptor firing rate.</p>\n<p><strong>Highyeild:</strong></p><p>The carotid sinus baroreceptors are most sensitive to the mean arterial baroreceptor. The baroreceptors are stretch receptors in the walls of the heart and blood vessels. The carotid sinus and aortic arch receptors (high-pressure regions) monitor arterial circulation. There are also stretch receptors in the low-pressure part of the circulation (cardiopulmonary receptors). The afferent nerve fibers from the carotid sinus form a distinct branch of the glossopharyngeal nerve, the carotid sinus nerve. The fibers from the aortic arch form a branch of the vagus nerve, the aortic depressor nerve.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- The carotid sinus baroreceptors can also detect changes in other hemodynamic variables, such as pulse pressure, systolic blood pressure, and diastolic blood pressure; they are most sensitive to changes in mean arterial pressure (MAP).</p>\n<p><strong>Extraedge:</strong></p><p>BARORECEPTOR REFLEX Short-term, fast neural response to change in blood pressure Alters peripheral resistance and cardiac output Mediated by baroreceptor cells Specialized nerve endings called mechanoreceptors, located in the aortic arch and carotid sinus; are sensitive to pressure or stretching Most sensitive to rapid pressure changes Carotid sinus baroreceptors: responsive to both decreases and increases in pressure Aortic arch baroreceptors: predominantly responsive to increases in pressure Change in blood pressure activates reflex arc Baroreceptors → afferent neurons → brain stem centers → processing information and generating response → efferent neurons → changes in the heart and blood vessels Increase of blood pressure → stretching of baroreceptors → depolarizing receptor potential (higher rate action potential) Decrease of blood pressure → decreased stretch of baroreceptors → hyperpolarizing potential (lower rate action potential) Sensitivity can be altered as a result of some diseases Chronic hypertension: the result is the adaptation of baroreceptors Baroreceptors are adjusted to monitor pressure changes at a higher setpoint Atherosclerosis: carotid sinus syndrome Baroreceptors are more sensitive; even light pressure on the carotid sinus can cause extreme bradycardia</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The afferent nerve fibers from the baroreceptors for blood pressure control synapse first at?", "options": [{"label": "A", "text": "Caudal ventrolateral medulla", "correct": false}, {"label": "B", "text": "Rostral ventrolateral medulla", "correct": false}, {"label": "C", "text": "Nucleus Ambiguus", "correct": false}, {"label": "D", "text": "Nucleus of tractus solitarius", "correct": true}], "correct_answer": "D. Nucleus of tractus solitarius", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Nucleus of tractus solitarius The nucleus tractus solitarii (NTS) receives afferent projections from the arterial baroreceptors , carotid chemoreceptors and cardiopulmonary receptors, and as a function of this information produces autonomic adjustments to maintain arterial blood pressure within a narrow range of variation</p>\n<p><strong>Highyeild:</strong></p><p>The baroreceptors are stretch receptors in the walls of the heart and blood vessels. Their afferent fibers pass via the glossopharyngeal and vagus nerves to the medulla. These fibers release glutamate to excite neurons in the nucleus of the tractus solitarius (NTS) as the first synapse in the baroreceptor reflex. These NTS neurons then excite neurons in the caudal ventrolateral medulla (CVLM). These CVLM neurons release the inhibitory neurotransmitter (GABA) into the RVLM to reduce the firing rate of these. Excitatory projections also extend from the NTS to the vagal motor neurons in the nucleus ambiguus and dorsal motor nucleus. Thus, increased baroreceptor discharge inhibits the tonic discharge of sympathetic nerves and excites the vagal innervation of the heart. These neural changes produce vasodilation, venodilation, hypotension, bradycardia, and a decrease in cardiac output.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- The caudal ventrolateral medulla (CVLM) and rostral ventrolateral medulla (RVLM) are also involved in blood pressure control and receive inputs from the NTS. However, the NTS is the first synapse for the afferent nerve fibers from the baroreceptors. The nucleus ambiguus is involved in the regulation of cardiac function, including heart rate and cardiac output, but is not directly involved in blood pressure control.</p>\n<p><strong>Extraedge:</strong></p><p>BARORECEPTOR REFLEX Short-term, fast neural response to change in blood pressure Alters peripheral resistance and cardiac output Mediated by baroreceptor cells Specialized nerve endings called mechanoreceptors, located in the aortic arch and carotid sinus; are sensitive to pressure or stretching Most sensitive to rapid pressure changes Carotid sinus baroreceptors: responsive to both decreases and increases in pressure Aortic arch baroreceptors: predominantly responsive to increases in pressure Change in blood pressure activates reflex arc Baroreceptors → afferent neurons → brain stem centers → processing information and generating response → efferent neurons → changes in the heart and blood vessels Increase of blood pressure → stretching of baroreceptors → depolarizing receptor potential (higher rate action potential) Decrease of blood pressure → decreased stretch of baroreceptors → hyperpolarizing potential (lower rate action potential) Sensitivity can be altered as a result of some diseases Chronic hypertension: the result is the adaptation of baroreceptors Baroreceptors are adjusted to monitor pressure changes at a higher setpoint Atherosclerosis: carotid sinus syndrome Baroreceptors are more sensitive; even light pressure on the carotid sinus can cause extreme bradycardia</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "What will happen when the common carotid arteries are occluded on both sides?", "options": [{"label": "A", "text": "Increase in blood pressure and decrease in the heart rate", "correct": false}, {"label": "B", "text": "Decrease in blood pressure and increase in the heart rate", "correct": false}, {"label": "C", "text": "Increase in blood pressure and increase in heart rate", "correct": true}, {"label": "D", "text": "No effect on blood pressure and heart rate", "correct": false}], "correct_answer": "C. Increase in blood pressure and increase in heart rate", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Increase in blood pressure and increase in heart rate A typical reflex change in arterial pressure is caused by occluding the two common carotid arteries. This reduces the carotid sinus pressure; as a result, signals from the baroreceptors decrease and cause a less inhibitory effect on the vasomotor center.</p>\n<p><strong>Highyeild:</strong></p><p>The vasomotor centre then becomes much more active than usual, causing the aortic arterial pressure to rise and remain elevated during the 10 minutes that the carotids are occluded. It causes decreased parasympathetic innervation to the heart thus causing an increased heart rate. The increased sympathetic activity of the heart and blood vessels increases heart rate, contractility, and constricts arterioles. Removal of the occlusion allows the pressure in the carotid sinuses to rise, and the carotid sinus reflex now causes the aortic pressure to fall immediately to slightly below normal as a momentary overcompensation and then return to normal in another minute.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest options are incorrect because The increase in blood pressure is due to the activation of the sympathetic nervous system, which causes vasoconstriction of the peripheral blood vessels and an increase in cardiac output. The increase in heart rate is also due to sympathetic activation, which leads to an increase in the firing rate of the sinoatrial node, the heart's natural pacemaker.</p>\n<p><strong>Extraedge:</strong></p><p>Bilateral occlusion of the common carotid arteries at their origin may even occur in cases presenting with Takayasu's arteritis.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following are the stimulus for the activation of peripheral chemoreceptors?", "options": [{"label": "A", "text": "Decreased partial pressure of oxygen", "correct": false}, {"label": "B", "text": "Increased partial pressure of carbon dioxide", "correct": false}, {"label": "C", "text": "Increase in the concentration of hydrogen ions", "correct": false}, {"label": "D", "text": "All of the above", "correct": true}], "correct_answer": "D. All of the above", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>All of the above The activation of peripheral chemoreceptors leads to the increased partial pressure of carbon dioxide, an increase in the concentration of hydrogen ions, and Decreased partial pressure of oxygen.</p>\n<p><strong>Highyeild:</strong></p><p>The chemoreceptors are chemosensitive cells sensitive to low oxygen, carbon dioxide excess, and hydrogen ion excess. They are located in several small chemoreceptor organs about 2 mm (two carotid bodies, one of which lies in the bifurcation of each common carotid artery). The chemoreceptors excite nerve fibers that, along with the baroreceptor fibers, pass through Hering’s nerves and the vagus nerves into the vasomotor center of the brain stem.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- All Given options are correct The stimuli for the activation of peripheral chemoreceptors are decreased partial pressure of oxygen (hypoxemia), increased partial pressure of carbon dioxide (hypercapnia), and an increase in the concentration of hydrogen ions (acidemia). Therefore, the correct answer is D. All of the above.</p>\n<p><strong>Extraedge:</strong></p><p>Located in the carotid and aortic bodies. Sensitive to low oxygen, carbon dioxide excess, and hydrogen excess. Direct effect-vagal stimulation leading to bradycardia. Indirect effect-tachycardia and increased cardiac output. Chemoreceptor activity leads to the formation of Meyer waves which are slow oscillations in arterial pressure occurring during hypotension.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The atrial stretch and the cardiopulmonary receptors CAUSE?", "options": [{"label": "A", "text": "Vasoconstriction", "correct": false}, {"label": "B", "text": "Vasodilatation", "correct": false}, {"label": "C", "text": "Tachycardia", "correct": false}, {"label": "D", "text": "Both b and c", "correct": true}], "correct_answer": "D. Both b and c", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Both b and c The atrial stretch and the cardiopulmonary receptors cause vasodilation and Tachycardia.</p>\n<p><strong>Highyeild:</strong></p><p>The stretch receptors in the atria are of two types: those that discharge primarily during atrial systole (type A), and those that discharge primarily in late diastole, at the time of peak atrial filling (type B). These are located in the right and left atria. They sense intravascular volume (atrial stretch or preload) Afferent fibers go to the cortex and hypothalamus. Stretch causes a decrease in BP and ADH release. Stretch also releases ANP which decreases Renin and Aldosterone release. The discharge of type B baroreceptors is increased when venous return is increased and decreased by positive-pressure breathing, indicating that these baroreceptors respond primarily to distension of the atrial walls. The reflex circulatory adjustments initiated by the activation of these receptors include vasodilation and a fall in blood pressure. However, the heart rate is increased rather than decreased</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Atrial stretch receptors send signals to the brainstem to trigger a reflex response that promotes vasodilation and increases renal blood flow ( Not Vasoconstriction).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "All of the following statements regarding nitric oxide are true except?", "options": [{"label": "A", "text": "Causes the Relaxation of the vascular smooth muscle", "correct": false}, {"label": "B", "text": "Acts by increasing cAMP levels", "correct": true}, {"label": "C", "text": "Derived from L-arginine amino acids", "correct": false}, {"label": "D", "text": "NOS 3 is found in endothelial cells", "correct": false}], "correct_answer": "B. Acts by increasing cAMP levels", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Acts by increasing cAMP levels Nitric oxide doesn’t act by increasing cAMP levels.</p>\n<p><strong>Highyeild:</strong></p><p>Many different stimuli act on endothelial cells to produce endothelium-derived relaxing factor now known to be Nitric oxide NO is synthesized from arginine in a reaction catalyzed by Nitric oxide synthase (NOS). Three isoforms of NOS have been identified: NOS 1: found in the nervous system NOS 2: Found in macrophages and other immune cells NOS 3: found in endothelial cells NOS 1 and 3 are activated by agents that increase the intracellular concentration of calcium including the vasodilators acetylcholine and bradykinin The NOS in immune cells is not activated by Calcium but is induced by cytokines. NO formed in the endothelium diffuses to the smooth muscle cells where it activates cGMP which in turn mediates the relaxation of vascular smooth muscle. It is also involved in vascular remodeling and angiogenesis. Involved in penile erection that accounts for the use of drugs such as Viagra.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest All options are explained in the high yield section.</p>\n<p><strong>Extraedge:</strong></p><p>NO is derived from the amino acid L-arginine by the enzyme nitric oxide synthase (NOS). There are three isoforms of NOS, including NOS 1 (neuronal), NOS 2 (inducible), and NOS 3 (endothelial). NOS 3 is found in endothelial cells and is responsible for producing the majority of NO in the body.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following is not true regarding the functions of endothelin?", "options": [{"label": "A", "text": "Regulates vascular tone", "correct": false}, {"label": "B", "text": "Most potent vasoconstrictor", "correct": false}, {"label": "C", "text": "Endothelin 1 is found in only the brain and the kidneys", "correct": true}, {"label": "D", "text": "Endothelin 2 is produced primarily by the kidneys and intestine", "correct": false}], "correct_answer": "C. Endothelin 1 is found in only the brain and the kidneys", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Endothelin 1 is found in only the brain and the kidneys It is found in the brain and kidneys as well as the endothelial cells.</p>\n<p><strong>Highyeild:</strong></p><p>Endothelial cells produce endothelin 1 which is the most potent vasoconstrictor. There are three endothelins: Endothelin 1 is secreted locally and acts in a paracrine fashion and appears to be a potent regulator of vascular tone. It is found in the brain and kidneys as well as the endothelial cells. Endothelin-2 is produced primarily in the kidneys and Endothelin-3 is present in the blood and is found in high concentrations in the brain. It is also found in the kidney and gastrointestinal tract. In the brain, endothelins are abundant and, in early life, are produced by both astrocytes and neurons. They are found in the dorsal root ganglia, ventral horn cells, the cortex, the hypothalamus, and cerebellar Purkinje cells. They also play a role in regulating transport across the blood-brain barrier. There are endothelin receptors on mesangial cells, and the polypeptide participates in tubuloglomerular feedback. Also, remember: Also causes platelet activation and has an inotropic effect. Closure of ductus arteriosus. Has a role in the pathogenesis of hypertension, myocardial infarction, and congestive heart failure. Role in tubuloglomerular feedback thus decreasing GFR. In the lungs it causes vasoconstriction.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Options A & B. It is one of the most potent vasoconstrictors known , and can have a significant impact on blood pressure regulation. Option D. Endothelin 2 (ET-2) is also produced by endothelial cells, but is primarily found in the kidneys and intestine .</p>\n<p><strong>Extraedge:</strong></p><p>ET-1 plays a role in regulating vascular tone and blood pressure by constricting blood vessels. It is also involved in cell proliferation, inflammation, and tissue remodeling.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 24 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "The 30-year-old male has total body water is 60% of the body weight. What are the proportions of ECF and ICF?", "options": [{"label": "A", "text": "20,40", "correct": true}, {"label": "B", "text": "40,20", "correct": false}, {"label": "C", "text": "30,60", "correct": false}, {"label": "D", "text": "60,30", "correct": false}], "correct_answer": "A. 20,40", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>20,40 When expressed as the percentage of body weight, 40% of body weight is in ICF (2/3rd of 60%), and 20% of body weight is in ECF (1/3rd of 60%).</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest all Options are incorrect.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Why is Homeostasis defined as a state of balance between continuing processes?", "options": [{"label": "A", "text": "All variables are given equal importance", "correct": false}, {"label": "B", "text": "Body maintains an internal balance within fluctuating limits", "correct": true}, {"label": "C", "text": "Can achieve a constancy in extreme environmental challenges", "correct": false}, {"label": "D", "text": "The set point for all homeostatic variables is always fixed", "correct": false}], "correct_answer": "B. Body maintains an internal balance within fluctuating limits", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Body maintains an internal balance within fluctuating limits Homeostasis is called dynamic equilibrium because the body maintains an internal balance within fluctuating limits.</p>\n<p><strong>Highyeild:</strong></p><p>Homeostasis is a dynamic equilibrium that is maintained in body tissues and organs. It is dynamic because it is constantly adjusting to the changes that the systems encounter. It is an equilibrium because body functions are kept within a normal range, with some fluctuations around a set point.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A . Several variables such as body temperature, blood sugar levels, blood pH, etc. are regulated within a range of values (homeostatic ranges) and not at fixed values. Option: C. The disruption of homeostasis either due to extreme environmental challenges or a breakdown of internal homeostatic mechanisms is termed as a disease Options: D. These variables are not given equal importance. There is a hierarchy of importance so that the constancy of certain variables may be altered markedly to maintain others within their normal range. For example, respiratory or metabolic compensation to maintain blood pH.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "An Industrial laborer moves in March from Kashmir to Delhi and becomes acclimatized by working outdoors for a month. Compared with his responses on the first few days in Delhi, for the same activity level after acclimatization, one would expect higher:", "options": [{"label": "A", "text": "Core temperature", "correct": false}, {"label": "B", "text": "Heart rate", "correct": false}, {"label": "C", "text": "Sweating rate", "correct": true}, {"label": "D", "text": "Sweat salt concentration", "correct": false}], "correct_answer": "C. Sweating rate", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Sweating rate Among the most important physiological changes that occur during this acclimatization process are an approximately two-fold increase in the maximum rate of sweating , an increase in plasma volume, and diminished loss of salt in the sweat and urine to almost none; the last two effects result from increased secretion of aldosterone by the adrenal glands.</p>\n<p><strong>Highyeild:</strong></p><p>The temperature control system uses three important mechanisms to reduce body heat when the body temperature becomes too great:- Vasodilation of skin blood vessels. Sweating. Decrease in heat production.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Core temperature is decreased due to sweating. Option: B. Heart rate doesn’t affect. Option: C. Sweat sodium concentration varies dramatically between individuals , from 250 mg/L to 3000 mg/L3, not by environment.</p>\n<p><strong>Extraedge:</strong></p><p>The function and pathology of sweating Sweating is the most important effector in thermoregulation and is controlled through the hypothalamus. ' Hyperhidrosis is characterized by an abnormal response to heat, exertion and stress with pronounced sweating either in general or focally.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A primigravida with 38 completed weeks of gestation has gone into labor. Oxytocin was started to augment labor. The secondary messenger system through which oxytocin acts is:", "options": [{"label": "A", "text": "cAMP", "correct": false}, {"label": "B", "text": "Phospholipase c", "correct": true}, {"label": "C", "text": "cGMP", "correct": false}, {"label": "D", "text": "Tyrosine kinase", "correct": false}], "correct_answer": "B. Phospholipase c", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Phospholipase c The second messenger system through which oxytocin acts is the Phospholipase C system</p>\n<p><strong>Highyeild:</strong></p><p>Even though the cytoplasmic receptors are present in the cytoplasm, once the Hormone-receptor complex is formed it moves to the nucleus for action. It activates the enzyme Phospholipase C which breaks down some phospholipids in the cell membrane into IP3 and DAG. DAG activates protein kinase C and IP3 mobilizes calcium from mitochondria and endoplasmic reticulum to bring about smooth muscle contraction and other cellular responses.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 61-year-old male with erectile dysfunction asks his physician to prescribe Viagra (sildenafil). Viagra produces its physiological effects by blocking the enzyme that hydrolyses the secondary messenger by which nitric oxide produces its physiological effects. Which of the following is the secondary messenger?", "options": [{"label": "A", "text": "Bradykinin", "correct": false}, {"label": "B", "text": "Cyclic GMP", "correct": true}, {"label": "C", "text": "Protein kinase A", "correct": false}, {"label": "D", "text": "Endothelin-1", "correct": false}], "correct_answer": "B. Cyclic GMP", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Cyclic GMP Sildenafil (sold under the brand name Viagra) inhibits PDE-5, increasing cyclic guanosine monophosphate cGMP to allow smooth-muscle relaxation by prolonging the action of NO.</p>\n<p><strong>Highyeild:</strong></p><p>It is used for erectile dysfunction. Penile erection is also produced by the release of NO, with consequent vasodilation and engorgement of the corpora cavernosa. This accounts for the efficacy of drugs such as Viagra that slow the breakdown of cGMP. NANC =Non-adrenergic, non-cholinergic nerve endings; GTP = guanylate triphosphate; cGMP = guanylate monophosphate; DE; = phosphodiesterase</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Bradykinin is a product of the kallikrein-induced breakdown of high-molecular-weight kininogen (HMWK) in the kinin cascade. Option: C. Protein kinase A is a cAMP-dependent protein kinase. Option: D. Endothelin-1 (ET-1) is a potent vasoconstrictor that increases vascular tone in the resistance vessels of subjects with hypertension.</p>\n<p><strong>Extraedge:</strong></p><p>Nitrates are contraindicated in a patient taking sildenafil : Sildenafil is contraindicated in patients taking any long-acting nitrates or using short-acting nitrates because of the risk of developing potentially life-threatening hypotension. All patients taking organic nitrates, even if they have not asked for Viagra, should be informed about the nitrate-sildenafil hypotensive interaction. Similarly, patients must be warned of the contraindication of taking sildenafil in the 24-hour time interval after taking a nitrate preparation, including sublingual nitroglycerin. Sildenafil is used for the treatment of pulmonary arterial hypertension.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 43-year-old pregnant woman develops preeclampsia at 32 weeks gestation. Magnesium sulfate, which interacts with NMDA receptors in the central nervous system, is ordered for the prevention of eclamptic seizures until the fetus can be delivered. Which of the following activates the NMDA receptor?", "options": [{"label": "A", "text": "Glycine", "correct": false}, {"label": "B", "text": "Acetylcholine", "correct": false}, {"label": "C", "text": "Substance P", "correct": false}, {"label": "D", "text": "Glutamate", "correct": true}], "correct_answer": "D. Glutamate", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Glutamate MgSO4 also acts centrally to inhibit NMDA receptors, providing anticonvulsant activity by increasing the seizure threshold. The NMDA receptor channel is a large channel permeable to Ca2+, K+, and Na+ It is activated by glutamate, but unlike other glutamate receptor channels, the NMDA channel is blocked by Mg2+ in its resting state.</p>\n<p><strong>Highyeild:</strong></p><p>MgSO4 is an effective treatment option for the prevention of eclampsia. Its mechanism of action is likely multifactorial, encompassing both vascular and neurological mechanisms. Being a calcium antagonist, its effect on vascular smooth muscle to promote relaxation and vasodilation may have a role in lowering total peripheral vascular resistance. In addition, MgS04 may effect the cerebral endothelium to limit vasogenic edema by decreasing stress fiber contraction and paracellular permeability via calcium-dependent second messenger systems such as MLC kinase. Depolarization of the cell membrane to approximately -40 mV removes the Mg2+ blockade. Therefore, the NMDA channel is only opened when the cell is depolarized by other excitatory neurotransmitters.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Glycine increases NMDA-elicited currents with submicromolar potency (EC50 of <1 µM) and also strongly slows their Option: B. NMDAR activation is indirectly modulated by ACh through the activation of muscarinic or nicotinic receptors. Option: C. Substance P's most well-known function is as a neurotransmitter and a modulator of pain perception by altering cellular signaling pathways.</p>\n<p><strong>Extraedge:</strong></p><p>Important facts of Glutamate & GABA glutamate - the principal excitatory NT in the brain NMDA glutamate receptors have an important role in learning & memory, schizophrenia & addiction ketamine - NMDA receptor antagonist that produces acute dissociation & schizophrenic-like symptoms GABA- the principal inhibitory NT in the brain GABA agonists (benzodiazepines, barbiturates, alcohol) have anxiolytic. sedative & hypnotic effects benzodiazepines are the most widely prescribed psychoactive drugs in the world; used to treat anxiety & insomnia, side-effects include impaired reaction time, attention & memory alcoholis both a GABA agonist & a glutamate antagonist long-term alcohol abuse alters balance of inhibitory/excitatory neurotransmission, which can lead to alcohol dependence & withdrawal syndromes acute subjective effects of alcohol are biphasic (low doses feel stimulating, high doses sedating), but even low doses can impair cognitive performance - especially on complex tasks (problem solving, driving)</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 42-year-old woman consults a dermatologist to evaluate and treat her glabellar lines (frown lines on the forehead just above the nose). After her treatment options are explained, the patient asks the dermatologist to administer Botox (botulinum type A). Botox injections smooth out glabellar lines by which of the following methods?", "options": [{"label": "A", "text": "Blocking the release of synaptic transmitters from α-motoneurons", "correct": true}, {"label": "B", "text": "Preventing the opening of sodium channels on muscle membranes", "correct": false}, {"label": "C", "text": "Decreasing the amount of calcium released from the sarcoplasmic reticulum", "correct": false}, {"label": "D", "text": "Increasing the flow of blood into the facial muscle", "correct": false}], "correct_answer": "A. Blocking the release of synaptic transmitters from α-motoneurons", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Blocking the release of synaptic transmitters from α-motoneurons Botulinum toxin inhibits the release of acetylcholine from α-motoneurons by blocking proteins responsible for the fusion of the synaptic channel with the presynaptic membrane.</p>\n<p><strong>Highyeild:</strong></p><p>Botulinum toxin also inhibits the release of acetylcholine from the neurons of the autonomic nervous system. Botulinum and tetanus toxin are released from the same class of bacteria (Clostridium). Tetanus toxin produces an increase in skeletal muscle contraction by blocking the release of inhibitory neurotransmitters from spinal interneurons.</p>\n<p><strong>Extraedge:</strong></p><p>Botulism is a paralytic disease caused by potent protein neurotoxins elaborated by clostridium botulinum. Botulism is characterized by symmetrical, descending, flaccid paralysis of motor and autonomic nerves usually beginning with cranial nerves. Structure and action of the botulinum neurotoxins. The figure shows a representation of the three-dimensional structure of a botulinum neurotoxin. The toxin exerts its neuroparalytic action via a four-step mechanism</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 76-year-old woman with a history of uncontrolled hypertension presents in the Emergency Department with hypotension and shock-like symptoms. Her daughter reported systolic blood pressure near 200 mmHg earlier in the day. The clinician suspects a dissecting aneurysm, which is confirmed with a CT of the chest. A biopsy of the repaired aorta shows giant cell arteritis, and the woman is placed on a regimen of high-dose prednisone. The anti-inflammatory effect of exogenous glucocorticoids is thought to be due to which of the following?", "options": [{"label": "A", "text": "Increased capillary membrane permeability", "correct": false}, {"label": "B", "text": "Increased formation of leukotrienes", "correct": false}, {"label": "C", "text": "Increased release of interleukin-1 (pyrogen) from granulocytes", "correct": false}, {"label": "D", "text": "Inhibition of the activation of NF-Kb", "correct": true}], "correct_answer": "D. Inhibition of the activation of NF-Kb", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Inhibition of the activation of NF-Kb Glucocorticoids inhibit the activation of NF-kB by increasing the production of IkBa, and this is probably the main basis of their anti-inflammatory action.</p>\n<p><strong>Highyeild:</strong></p><p>Evidence is accumulating that the transcription factor, nuclear factor-kB (NF-kB), plays a key role in the inflammatory response. NF-kB is a heterodimer that normally exists in the cytoplasm of cells bound to IkBa, which renders it inactive. The anti-inflammatory effects of exogenous glucocorticoids are due to their ability to decrease capillary membrane permeability and probably also to their ability to stabilize Lysosomal membranes and decrease the formation of bradykinin. Glucocorticoids inhibit the enzyme phospholipase A2 ; this decreases the release of arachidonic acid and the variety of substances produced from it, such as M .</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect options:- Rest All other options are incorrect because glucocorticoids inhibit leukotrienes, capillary membrane permeability, and interleukins.</p>\n<p><strong>Extraedge:</strong></p><p>Hormones That produces from Adrenal gland :-</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Although more than 400 blood groups have been identified, the ABO blood group system remains the most important in clinical medicine because:", "options": [{"label": "A", "text": "It was the first blood group system to be discovered", "correct": false}, {"label": "B", "text": "It has four different blood groups A, B, AB, O(H)", "correct": false}, {"label": "C", "text": "ABO (H) antigens are present in most body tissues and fluids", "correct": false}, {"label": "D", "text": "ABO (H) antibodies are invariably present in plasma when a person’s RBC lacks the corresponding antigen", "correct": true}], "correct_answer": "D. ABO (H) antibodies are invariably present in plasma when a person’s RBC lacks the corresponding antigen", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>ABO (H) antibodies are invariably present in plasma when a person’s RBC lacks the corresponding antigen This is not present with other blood group antigens. For example, an Rh-negative individual does not have Anti-Rh antibodies unless the person came in contact with Rh-positive blood. Therefore, ABO typing is clinically responsible for the maximum number of transfusion reactions.</p>\n<p><strong>Highyeild:</strong></p><p>THE GENETICS OF BLOOD TYPES: The A and B antigens are inherited as mendelian dominants, and individuals are divided into four major blood types on this basis. Type A individuals have the A antigen, type B has the B, type AB has both, and type O has The A and B antigens are complex oligosaccharides that differ in their terminal sugar. An H gene codes for a fucose transferase that adds a terminal fucose, forming the H antigen that is usually present in individuals of all blood types. Individuals with type A also expresses another transferase that catalyzes the placement of a terminal N-acetylgalactosamine on the H antigen, whereas individuals with type B express a transferase that places a terminal galactose. Individuals with type AB have both transferases. Individuals with type O have neither, so the H antigen persists.</p>\n<p><strong>Extraedge:</strong></p><p>The ABO blood type is inherited in an autosomal codominant fashion. The A and B alleles are codominant, and the O allele is recessive.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following is true about the process shown in the given Image below?", "options": [{"label": "A", "text": "A carrier protein is required in this process", "correct": false}, {"label": "B", "text": "It occurs along the concentration gradient", "correct": false}, {"label": "C", "text": "It occurs against the concentration gradient", "correct": false}, {"label": "D", "text": "Secretory products like hormones pass through this process", "correct": true}], "correct_answer": "D. Secretory products like hormones pass through this process", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Secretory products like hormones pass through this process The process shown in the image is exocytosis and it is an energy-independent process. Exocytosis is required for the transport of hormones.</p>\n<p><strong>Highyeild:</strong></p><p>Exocytosis, in most cases, is stimulated by the entry of calcium ions into the cell; calcium ions interact with the vesicular membrane and cause its fusion with the cell membrane, followed by exocytosis. That is, the opening of the membrane's outer surface and extrusion of its contents outside the cell.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. A carrier protein is required in this process : A carrier protein is required in facilitated diffusion. Option: B. It occurs along the concentration gradient: Osmosis and diffusion occur along the concentration gradient. Option: C. It occurs against the concentration gradient: Exocytosis has no relation with the concentration gradient.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 35-year-old man visits his family doctor, complaining about a fever. The blood test revealed elevated neutrophils. The elevated Neutrophils will reach the infection site by crossing the walls of blood vessels. The flexibility of cells is due to this compositions of cell membrane:", "options": [{"label": "A", "text": "Unsaturated fatty acids", "correct": false}, {"label": "B", "text": "Oleic acid", "correct": false}, {"label": "C", "text": "Linoleic acid", "correct": false}, {"label": "D", "text": "All the above", "correct": true}], "correct_answer": "D. All the above", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>All the above The flexibility of the cell membrane is a function of lipids. This is due to the presence of unsaturated fatty acids e.g., Oleic acid and linoleic acid</p>\n<p><strong>Highyeild:</strong></p><p>Fluid mosaic model: This model states that the components of a membrane such as proteins or glycolipids form a mobile mosaic in the fluid-like environment created by a sea of phospholipids.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- All options are true and option D would be the answer.</p>\n<p><strong>Extraedge:</strong></p><p>Saturated fatty acids lack double bonds between the individual carbon atoms, while in unsaturated fatty acids there is at least one double bond in the fatty acid chain. Examples of saturated fatty acids :- Stearic acid (18 Carbon) , Palmitic acid (16 Carbon). Examples of unsaturated fatty acids:- Linoleic acid (18 Carbon ) , Oleic acid (18 Carbon) Arachidonic acid (20 Carbon).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Lipids constitute 40-45% of the cell membrane, mainly the phospholipid. They are arranged in a bilayer to avoid rupture of the membrane, since one end of the phospholipid is polar whereas the other is non-polar. Which statement is true about the polarity of the membrane is:", "options": [{"label": "A", "text": "Head consists of phosphate anion and is hydrophobic", "correct": false}, {"label": "B", "text": "Tail consists of non-polar hydrophilic end", "correct": false}, {"label": "C", "text": "Head is non-polar, whereas tail is polar", "correct": false}, {"label": "D", "text": "Head is polar and hydrophilic", "correct": true}], "correct_answer": "D. Head is polar and hydrophilic", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Head is polar and hydrophilic The head is polar and it's hydrophilic , therefore option D is the only correct answer.</p>\n<p><strong>Highyeild:</strong></p><p>The plasma membrane is about 7.5 nm (75 angstroms [A]) thick. The major lipids are phospholipids such as phosphatidylcholine, phosphatidylserine, and phosphatidylethanolamine. The shape of the phospholipid molecule reflects its solubility properties: the \"head end of the molecule contains the phosphate portion and is relatively soluble in water (polar, hydrophilic) and the \"tail\" ends are relatively insoluble (nonpolar, hydrophobic) . The possession of both hydrophilic and hydrophobic properties makes the lipid an amphipathic molecule. In the membrane, the hydrophilic ends of the molecules are exposed to the aqueous environment.</p>\n<p><strong>Random:</strong></p><p>Explanation for incorrect options: - Option: A. Head consists of phosphate anion and is polar and hydrophilic. Option: B. Tail consists of a lipid chain and is hydrophobic (since non-polar) Option: C. Head is polar, whereas the tail is non-polar.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 38-year-old male visits the hospital, with difficulty in breathing and coughing. He says, it occurs mainly at night and feels chest pain also. The doctor noticed a wheezing sound also and after examining the patient carefully and concluded that it was Asthma and prescribed him steroids. Which statement is true about the entry of steroids into the cell?", "options": [{"label": "A", "text": "Lipid of cell membrane helps steroids to enter", "correct": true}, {"label": "B", "text": "Protein carrier helps steroids to enter the cell", "correct": false}, {"label": "C", "text": "Steroids do not enter the cell but act through cell surface receptors", "correct": false}, {"label": "D", "text": "Steroids are water-soluble and act through aquaporins", "correct": false}], "correct_answer": "A. Lipid of cell membrane helps steroids to enter", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Lipid of cell membrane helps steroids to enter Steroids are lipid-soluble hormones and therefore their entry through the cell membrane is quite smooth because a big constituent of the cell membrane is lipid. So they diffuse into the cell membrane being soluble in lipids. Therefore, option A is true. Rest are false.</p>\n<p><strong>Highyeild:</strong></p><p>The plasma membrane is about 7.5 nm (75 angstroms [À]) thick. The major lipids are phospholipids such as phosphatidylcholine, phosphatidylserine, and phosphatidylethanolamine. The shape of the phospholipid molecule reflects its solubility properties: the \"head\" end of the molecule contains the phosphate portion and is relatively soluble in water (polar, hydrophilic) and the \"tail\" ends are relatively insoluble (nonpolar, hydrophobic). The possession of both hydrophilic and hydrophobic properties makes the lipid an amphipathic molecule. In the membrane, the hydrophilic ends of the molecules are exposed to the aqueous environment.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect options:- Option: B. While protein carriers are involved in the transport of some molecules across the cell membrane, they do not play a significant role in the entry of steroids into the cell. Steroids are lipophilic molecules, and as such, they can diffuse across the hydrophobic lipid bilayer of the cell membrane without the need for a protein carrier . Therefore, the statement \"Protein carrier helps steroids to enter the cell\" is not true. Option: C. Steroids do not enter the cell but act through cell surface receptors , this is an incorrect answer. Option: D. This statement is not true. Steroids are typically lipophilic , which means that they are not water-soluble.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "You are giving a presentation on the cell membrane structure in your class. While presenting your professor asked that the plasma membrane is made up of a lipid bilayer which determines the ability of substances to move in and out of the cell. Which of the following substances are lipid soluble and water soluble respectively?", "options": [{"label": "A", "text": "Lipid soluble- CO2 and O2 ,water-soluble-sodium and glucose", "correct": true}, {"label": "B", "text": "Lipid soluble- O2 and glucose, water-soluble- Na+ and k+", "correct": false}, {"label": "C", "text": "Lipid soluble- CO2 and glucose, water-soluble- Na+ and O2", "correct": false}, {"label": "D", "text": "Lipid soluble- CO2 and O2, water-soluble- steroid hormones and k+", "correct": false}], "correct_answer": "A. Lipid soluble- CO2 and O2 ,water-soluble-sodium and glucose", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Lipid soluble- CO2 and O2 ,water-soluble-sodium and glucose Small lipid-soluble substances can easily pass through the plasma membrane without any transporters and channels. These substances include O2, CO2, fatty acids, and some steroid hormones.</p>\n<p><strong>Highyeild:</strong></p><p>Due to the hydrophilic state water-soluble substances require a channel or transporter to pass through the lipid bilayer. These include Na+, K+, chloride, glucose, and water.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Options: B, C, and D. other matches are false. < Option: D. is not entirely accurate because steroid hormones, being lipid-soluble molecules, can easily pass through the lipid bilayer and enter the cell, and so they are not considered water-soluble. Potassium ions (K+) are also water-soluble and cannot pass through the lipid bilayer without the help of specialized transport proteins.</p>\n<p><strong>Extraedge:</strong></p><p>The lipid bilayer of the cell membrane is primarily composed of phospholipids, which are hydrophobic (water-repelling) molecules. Substances that are also hydrophobic, such as gasses like carbon dioxide (CO2) and oxygen (O2), can easily pass through the lipid bilayer and enter the cell. In contrast, water-soluble substances such as ions (e.g., sodium, Na+) and glucose are hydrophilic (water-loving) and cannot cross the lipid bilayer directly. Instead, they require specialized transport proteins such as ion channels or carrier proteins to move across the membrane.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "You are a medical student and you are allotted a topic to present in class. The topic given to you was excitation-contraction coupling. It is a process in which muscle cells are stimulated to contract and it is followed by muscle cell relaxation. It involves the following events. Action potential Calcium release into the cytoplasm Cross-bridge cycling Cytoplasmic calcium removal Depolarization of T tubules Which of the following options lists the correct sequence of events for excitation-contraction coupling in skeletal muscle tissue? Select the correct answer from the given below code:", "options": [{"label": "A", "text": "1,5,2,3,4", "correct": true}, {"label": "B", "text": "1,2,3,4,5", "correct": false}, {"label": "C", "text": "1,3,4,2,5", "correct": false}, {"label": "D", "text": "1,4,2,5,3", "correct": false}], "correct_answer": "A. 1,5,2,3,4", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>1,5,2,3,4 Action potential comes and causes Depolarization of T tubules which causes calcium release into the cytoplasm. Free calcium binds to troponin C on actin filaments and causes a conformational change and exposes a site on the actin molecule that binds to the myosin head which results in ATP hydrolysis and produces crossbridge cycling. And producing a contraction. Finally calcium is re-sequestrated back into ER to allow relaxation to occur. ' So the correct sequence is A.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- The rest of the other sequences are false.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following is the approximate extracellular fluid volume of a normal individual?", "options": [{"label": "A", "text": "5% of body mass", "correct": false}, {"label": "B", "text": "10% of body mass", "correct": false}, {"label": "C", "text": "20% of body mass", "correct": true}, {"label": "D", "text": "40% of body mass", "correct": false}], "correct_answer": "C. 20% of body mass", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>20% of body mass Sixty percent of the body mass is water. Of this water, one-third (20% of body mass) is extracellular and two-thirds (40% of body mass) is intracellular.</p>\n<p><strong>Highyeild:</strong></p><p>The extracellular water is further divided into interstitial water (80% of extracellular fluid, or 15% of body mass) and plasma water (20% of extracellular fluid, or 5% of body mass). The percentage of water in the body is a function of body fat. The greater the percentage of body fat, the lower the percentage of body water About three-fourths of the lean body mass (mass excluding fat) is water. The distribution of extracellular and intracellular water is a function of extracellular osmolality. If the osmolality of the extracellular fluid is above normal, the proportion of water in the extracellular fluid, in comparison to that in the intracellular water, increases; hypotonicity of the extracellular water decreases the proportion of water in the extracellular fluid.</p>\n<p><strong>Extraedge:</strong></p><p>The total body water (TBW) of an average adult is approximately 60% of their body mass. Of this, about two-thirds (40% of body mass) is intracellular fluid, and one-third (20% of body mass) is extracellular fluid.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following is true regarding auto-regulation?", "options": [{"label": "A", "text": "Vary with change in pressure", "correct": false}, {"label": "B", "text": "Maintains the blood flow", "correct": true}, {"label": "C", "text": "Well-developed in the skin", "correct": false}, {"label": "D", "text": "Regulated by local metabolites", "correct": false}], "correct_answer": "B. Maintains the blood flow", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Maintains the blood flow The capacity of tissues to regulate their blood flow is referred to as autoregulation.</p>\n<p><strong>Highyeild:</strong></p><p>Autoregulation of blood by organs and factors determining Autoregulation:- table,tr,th,td {border:1px solid black;} ORGAN FACTORS DETERMINING AUTOREGULATION Lungs Hypoxia causes vasoconstriction Heart Local metabolites (vasodilatory): NO, CO 2 , ↓O 2 Brain Local metabolites (vasodilatory): CO 2 (pH) Kidneys Myogenic (stretch reflex of afferent arteriole) and tubuloglomerular feedback Skeletal muscle Local metabolites during exercise (vasodilatory): C O 2 , H + , A denosine, L actate, K + At rest: sympathetic tone in arteries Skin Sympathetic vasoconstriction most important mechanism for temperature control</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Options: A, B. Most vascular beds have an intrinsic capacity to compensate for moderate changes in perfusion pressure by changes in vascular resistance, so that blood flow remains relatively constant. So it does not change with a change in pressure but rather stays constant. And also maintains the blood flow. Option: C. This capacity is well developed in the kidneys, but it has also been observed in the mesentery skeletal muscle, brain, liver, and myocardium. But not present in the skin. Option: D. Vasodilator substances tend to accumulate in active tissues, and these “metabolites” also contribute to autoregulation (metabolic theory of autoregulation). When blood flow decreases, they accumulate and the vessels dilate; when blood flow increases, they tend to be washed away.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 27 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A 36-year-old man was brought to the emergency with confusion and lethargy. His temperature is 36.7 C, blood pressure is 86/48mm Hg, the pulse is 120/min, and respirations are 12/min. pH is 7.59, pCO2 49 mm Hg, and pO2 85mm Hg. Which of the following laboratory studies would be useful for diagnosing the cause?", "options": [{"label": "A", "text": "Serum ketones", "correct": false}, {"label": "B", "text": "Serum osmolality", "correct": false}, {"label": "C", "text": "Serum Sodium", "correct": false}, {"label": "D", "text": "Urine chloride", "correct": true}], "correct_answer": "D. Urine chloride", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Urine chloride Arterial blood pH> 7.45 indicates alkalosis . This acid-base disturbance can occur due to decreased pCO2(respiratory alkalosis) or increased -(respiratory alkalosis).</p>\n<p><strong>Highyeild:</strong></p><p>Metabolic and respiratory alkalosis can be differentiated by pCO2 Respiratory alkalosis pCO2 < 40 mm Hg, Metabolic alkalosis pCO2 > 40 mm Hg. Ascertaining a patient's volume status and checking the urine chloride status are important steps in respiratory alkalosis.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A: Assessment of urine glucose and serum ketones are helpful in the evaluation of metabolic acidosis. However, the patient has respiratory alkalosis. Option: B and C: Serum sodium and osmolality do not necessarily provide information on a patient’s volume status and cannot be used to reliably differentiate hypo from hypervolemia.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "As a part of a space research program, a physiologist was asked to investigate the effect of flight-induced stress on blood pressure. Accordingly, the blood pressure of the cosmonauts was to be measured twice: once before the take-off and once after the spacecraft entered the designated orbit around the earth. For a proper comparison, the preflight blood pressure should be recorded in:", "options": [{"label": "A", "text": "The lying down position", "correct": true}, {"label": "B", "text": "The sitting position", "correct": false}, {"label": "C", "text": "The standing position", "correct": false}, {"label": "D", "text": "Any position as long as the post-flight recording is made in the same position", "correct": false}], "correct_answer": "A. The lying down position", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The lying down position When an aviator is subjected to positive G, blood is centrifuged toward the lowermost part of the body . Thus, if the centrifugal acceleratory force is +5 G and the person is in an immobilized standing position, the pressure in the veins of the feet becomes greatly increased (to about 450 mm Hg).</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. In the sitting position, the pressure becomes nearly 300 mm Hg. In addition, as the pressure in the vessels of the lower body increases, these vessels passively dilate so that a major portion of the blood from the upper body is translocated into the lower vessels. Because the heart cannot pump unless blood returns to it, the greater the quantity of blood pooled in this way in the lower body, the less that is available for the cardiac output. Option C. Measuring blood pressure in the supine position shows lower blood pressure readings when compared with the seated position.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A shift of posture from supine to upright posture is associated with cardiovascular adjustments. Which of the following is not true in this context?", "options": [{"label": "A", "text": "Rise in central venous pressure", "correct": true}, {"label": "B", "text": "Rise in heart rate", "correct": false}, {"label": "C", "text": "Decrease in cardiac output", "correct": false}, {"label": "D", "text": "Decrease in stroke volume", "correct": false}], "correct_answer": "A. Rise in central venous pressure", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Rise in central venous pressure The listed conditions decrease central venous pressure, which triggers an increase in sympathetic activity . Na+ depletion Diuretics Hypotension Hemorrhage Upright posture Dehydration Cardiac failure Cirrhosis Constriction of the renal artery or aorta Various psychological stimuli</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Appropriate Options are - Option B. Rise in heart rate Option C. Decrease in cardiac output Option D. Decrease in stroke volume</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 57-year-old male complains of an irregular heartbeat that he notices is relieved by pressing on his eyeball. An electrocardiogram reveals atrial fibrillation. Which of the following is most likely to accompany this condition?", "options": [{"label": "A", "text": "An increased venous A wave", "correct": false}, {"label": "B", "text": "An increased left atrial pressure", "correct": true}, {"label": "C", "text": "A decreased heart rate", "correct": false}, {"label": "D", "text": "An increased stroke volume", "correct": false}], "correct_answer": "B. An increased left atrial pressure", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>An increased left atrial pressure Atrial fibrillation is an arrhythmia in which the electrical activity of the atrium becomes disorganized and therefore unable to produce a coordinated atrial contraction . The absence of an arterial pulse reduces the emptying of the atria during diastole and results in an enlarged left atrium and increased left atrial pressure.</p>\n<p><strong>Highyeild:</strong></p><p>CVP waves: CVP is generally measured at the junction of the superior vena cava and the right atrium. This is most commonly done via a central venous catheter placed through the right internal jugular vein. A normal CVP waveform contains five components. These components include three peaks (a, c, v) and two descents (x, y). The first peak is the a-wave, which immediately follows the P wave of the ECG waveform. The a-wave is a pressure increase that is due to atrial contraction at end-diastole. Shortly after the a-wave, there is a second peak, the c-wave. The c-wave immediately follows the R wave of the ECG waveform. This is a pressure increase due to tricuspid bulging into the atrium as a result of isovolumic ventricular contraction (IVC). Following the c-wave is the first major descent in the CVP waveform, the x-descent. The x-descent is a drop in atrial pressure during ventricular systole caused by atrial relaxation. At the trough of the x-descent, there is an increase in atrial pressure as the atrium begins to fill during late systole. This is called the v-wave. The v-wave corresponds to the end of the T-wave in the ECG waveform. The final aspect of the CVP waveform is the y-descent, which is due to an atrial pressure drop as blood enters the ventricle during diastole.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. The venous A wave represents atrial contraction and disappears due to the absence of an atrial beat. Decreased filling of the heart results in a decrease in stroke volume. Options C and D. Heart rate increases because the continuous electrical activity of the atria initiates a high rate of ventricular activity. Systemic blood pressure typically falls because of inadequate filling of the ventricles and the resulting decrease in stroke volume .</p>\n<p><strong>Extraedge:</strong></p><p>The waveforms seen in a normal JVP are:- a wave corresponds to atrial contraction and occurs just after the P wave (on ECG) and just before the first heart sound. c wave represents the bulging of the tricuspid valve into the right atrium during ventricular systole. x descent corresponds to the atrial relaxation during atrial diastole. v wave represents atrial filling during ventricular systole and peaks at the second heart sound. y descent represents the passive emptying of the right atrium into the right ventricle after the tricuspid valve opening.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Blood supply during exercise does not decrease in:", "options": [{"label": "A", "text": "Coronary circulation", "correct": true}, {"label": "B", "text": "Renal circulation", "correct": false}, {"label": "C", "text": "Hepato splanchnic circulation", "correct": false}, {"label": "D", "text": "Cutaneous circulation", "correct": false}], "correct_answer": "A. Coronary circulation", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Coronary circulation A great increase in venous return also takes place with exercise, although the increase in venous return is not the primary cause of the increase in cardiac output.</p>\n<p><strong>Highyeild:</strong></p><p>Venous return is increased by the activity of the muscle and thoracic pumps; by mobilization of blood from the viscera; by increased pressure transmitted through the dilated arterioles to the veins; and by noradrenergically mediated venoconstriction, which decreases the volume of blood in the veins. Blood mobilized from the splanchnic area and other reservoirs may increase the amount of blood in the arterial portion of the circulation by as much as 30% during strenuous exercise.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. Renal circulation Option C. Hepato splanchnic circulation Option D. Cutaneous circulation The circulation to all these organs decreases during exercise to compensate for increased blood circulation to the skeletal muscles.</p>\n<p><strong>Extraedge:</strong></p><p>Circulatory Changes during Exercise When a muscle contracts, it compresses the vessels in it if it develops more than 10% of its maximal tension; when it develops more than 70% of its maximal tension, blood flow is completely stopped. Between contractions, however, flow is so greatly increased that blood flow per unit of time in a rhythmically contracting muscle is increased as much as 30-foldQ. Local mechanisms maintaining a high blood flow in exercising muscle include: a fall in tissue pO, a rise in tissue pCO , and accumulation of K+ and other vasodilator metabolites. The temperature rises in active muscle, and this further dilates the vessels. The systemic cardiovascular response to exercise that provides for the additional blood flow to contracting muscle depends on whether the muscle contractions are primarily isometric or primarily isotonic with the performance of external work. With the start of an isometric muscle contraction, the heart rate rises, probably as a result of psychic stimuli acting on the medulla oblongata. The increase is largely due to decreased vagal tone, although increased discharge of the cardiac sympathetic nerves plays some role. Within a few seconds of the onset of an isometric muscle contraction, systolic and diastolic blood pressures rise sharply. Stroke volume changes relatively little, and blood flow to the steadily contracting muscles is reduced as a result of the compression of their blood vessels. In addition, there is a net fall in total peripheral resistance due to vasodilation in exercising muscles. Consequently, systolic blood pressure rises only moderately, whereas diastolic pressure usually remains unchanged or falls. Cardiac output is increased during isotonic exercise to values that may exceed 35 L/min, the amount being proportional to the increase in The maximal heart rate achieved during exercise decreases with age. Both at rest and any given level of exercise, trained athletes have a larger stroke volume and lower heart rate than untrained individuals and they tend to have larger hearts. Training increases the maximal oxygen consumption (V· O2max) that can be produced by exercise in an individual. A great increase in venous return also takes place with exercise, although the increase in venous return is not the primary cause of the increase in cardiac output.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 22-year-old subject who is sitting quietly begins to squeeze a rubber ball repetitively in her right hand, using moderate strength. During this time her mean arterial pressure does not increase. Using her cardiovascular state before the exercise as a baseline, which of the following would best describe her cardiovascular state during the exercise?", "options": [{"label": "A", "text": "Increased blood flow through her right brachial artery", "correct": true}, {"label": "B", "text": "No Change In Cardiac Output", "correct": false}, {"label": "C", "text": "Increased Total Peripheral Resistance", "correct": false}, {"label": "D", "text": "Decreased blood flow through her left brachial artery", "correct": false}], "correct_answer": "A. Increased blood flow through her right brachial artery", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Increased blood flow through her right brachial artery The increased metabolic activity of the muscles in the subject’s right arm will induce the relaxation of small arteries and arterioles, thus reducing local resistance as well as total peripheral resistance . This, along with no change in mean arterial pressure, will result in an increase in blood flow through her right brachial artery.</p>\n<p><strong>Highyeild:</strong></p><p>Changes in blood flow through any vascular bed normally are met by changes in cardiac output.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- The increased blood flow to the right arm will be accomplished by an increase in heart rate and cardiac output, not by a decrease in flow to other organs.</p>\n<p><strong>Extraedge:</strong></p><p>Autoregulation: The process of maintaining blood flow constant in the face of varying mean arterial pressures. Active hyperemia: The increase in blood flow in response to an increase in metabolic activity. Reactive hyperemia: The temporary increase in blood flow seen following a period of ischemia. Edema safety factor: Compensatory mechanisms (mostly increases in lymph flow) that can accommodate increases in capillary filtration and mitigate edema formation.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 16 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "Which of the following is true regarding the Gap junctions present in the cardiac muscle?", "options": [{"label": "A", "text": "Are absent in cardiac muscle", "correct": false}, {"label": "B", "text": "Are present but of little functional importance in cardiac muscle", "correct": false}, {"label": "C", "text": "Are present and provide the pathway for the rapid spread of excitation from one cardiac muscle fiber to another", "correct": true}, {"label": "D", "text": "Are absent in smooth muscle", "correct": false}], "correct_answer": "C. Are present and provide the pathway for the rapid spread of excitation from one cardiac muscle fiber to another", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Are present and provide the pathway for the rapid spread of excitation from one cardiac muscle fiber to another Gap junctions provide the pathway for the rapid spread of excitation from one cardiac muscle fiber to another.</p>\n<p><strong>Highyeild:</strong></p><p>Striated muscle, Z lines are present. The membranes of adjacent muscle fibers form folds occurring always at the Z line called intercalated discs, which is a special property of the cardiac muscle. These maintain cell-to-cell Along the sides of the muscle fibers next to the discs, the cell membranes of the adjacent muscle fibers fuse for considerable distances forming gap junctions, which permit the cardiac muscle to function as a syncytium. The T system in cardiac muscle is located at the Z lines rather than the A-I junction in skeletal muscle.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. FALSE- Myocardial fibers have a resting membrane potential of approximately −90mV.The cardiac muscle acts as a syncytium because of the presence of gap junctions . Option: B. FALSE- They permit the cardiac muscle to function as a syncytium even though no protoplasmic bridges are present between the cells. Option: D. FALSE- Are present in smooth muscle. Intercalated discs contain three different types of cell-cell junctions: Fascia adherens junctions:- Where actin filaments attach thin filaments in the muscle sarcomeres to the cell membrane. Expanded desmosomes:- Sites of strong adhesion, that help to keep the muscle cells connected when they contract. Gap junctions:- Large and small, which provide direct contact between the cardiac cells, facilitating electrical communication, so that waves of depolarisation spread rapidly over the entire heart, by passing from cell to cell.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The action potential of a human ventricular myocyte_____ a. Has a duration of 20–30 milliseconds. b. Has a long duration mainly due to the prolonged activation of Na channels. c. Exhibits a plateau, during which the ventricle is already contracting. d. Is associated with an early fall in sarcolemmal permeability to K+ ions. e. Has a shorter duration in subepicardial than subendocardial myocytes. Consider the following statements. Which of the following options is true? Select the cottect answer from the given below code:", "options": [{"label": "A", "text": "Only a and b", "correct": false}, {"label": "B", "text": "c, d, and e", "correct": true}, {"label": "C", "text": "a, b, and c", "correct": false}, {"label": "D", "text": "b, c, and d", "correct": false}], "correct_answer": "B. c, d, and e", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>c, d, and e Statement: A. False-A cardiac action potential lasts much longer, 200--300ms. Statement: B. False- The long plateau is caused by Ca channel activation, and later the 3 Na+--Ca exchanger current. Statement: C. True- Contraction begins soon after the initial depolarization; ejection has already peaked by the end of the plateau. Statement: D. True- The reduced open state of the inward rectifier channel Ki , reduces K+ ion loss during the long cardiac action potential. Statement: E. True- This determines the T interval of an ECG and accounts for the fact that the T wave is upright, even though repolarization is the reverse of depolarization.</p>\n<p><strong>Extraedge:</strong></p><p>Drugs affecting the cardiac action potential. The sharp rise in voltage (\"0\") corresponds to the influx of sodium ions, whereas the two decays (\"1\" and \"3\", respectively) correspond to the sodium-channel inactivation and the repolarizing efflux of potassium ions. The characteristic plateau (\"2\") results from the opening of voltage-sensitive calcium channels.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The graph shows the relationship between NaCl delivery to the macula densa and resistance in the afferent arteriole. Based on the data, which of the following diuretics will most likely result in afferent arteriole vasoconstriction?", "options": [{"label": "A", "text": "Acetazolamide", "correct": true}, {"label": "B", "text": "Amiloride", "correct": false}, {"label": "C", "text": "Furosemide", "correct": false}, {"label": "D", "text": "Hydrochlorothiazide", "correct": false}], "correct_answer": "A. Acetazolamide", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683533737083-QTDY035003IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Acetazolamide Acetazolamide inhibits carbonic anhydrase (CA) in the proximal tubule, thereby impairing HCOand Na+ reabsorption and causing osmotic One consequence is that the tubule fluid arriving at the macula densa is relatively sodium-rich, triggering a reflex increase in afferent arteriolar (AA) resistance. The graph above shows that increased NaCl delivery to the macula densa raises glomerular afferent arteriolar resistance, a response mediated by tubuloglomerular feedback .</p>\n<p><strong>Highyeild:</strong></p><p>The macula densa is a specialized region of the renal tubule located in the wall of the thick ascending limb (TAL) of the loop of Henle a short distance (less than 50 mm) before it transitions to the distal convoluted tubule. It is designed to sense tubule NaCl levels. Na+ and Cl- enter macula densa cells via the Na+-K+-2Cl- cotransporter (NKCC). Cl- then exits the cell via a basolateral Cl- channel causing depolarization and generating a sensory signal that travels within the juxtaglomerular apparatus to the glomerular arterioles. The AA constricts and the efferent arteriole (EA) dilates as a result, thereby reducing filtration pressure and glomerular filtration rate (GFR). Tubuloglomerular feedback (TGF) is designed to optimize GFR in the face of changing glomerular perfusion pressures. Acetazolamide thus mimics the effect of inappropriate increases in GFR in a healthy individual. CA inhibitors cause modest diuresis and natriuresis, but they also increase urinary HCO3- excretion, thereby raising urinary pH to about eight and causing metabolic</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B: Amiloride is a K+-sparing diuretic that blocks the epithelial sodium channel (ENaC) that normally mediates Na+ reabsorption by principal cells in the distal segments. Amiloride does not affect TGF. Option C: Furosemide is a potent loop diuretic that inhibits NKCC and interferes with Na+, K+, and Cl- reabsorption in the TAL. The macula densa is located at the junction between the TAL and the distal tubule, so furosemide treatment inevitably exposes the macula densa to an increased NaCl load . One might thus expect the AA to constrict via TGF, but TGF relies on a functional NKCC. With NKCC blocked by furosemide, macula densa cells can no longer sense tubule NaCl levels and TGF is interrupted. Option D: Hydrochlorothiazide inhibits the Na+-Cl- cotransporter in the distal tubule, which is downstream of the macula densa. superscript 3- wherever HCO3- is present.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A single cell within a culture of freshly isolated cardiac muscle cells is injected with a fluorescent dye that cannot cross cell membranes. Within minutes, several adjacent cells become fluorescent. The most likely explanation for this observation is the presence of:", "options": [{"label": "A", "text": "Gap junctions", "correct": true}, {"label": "B", "text": "IP3 receptors", "correct": false}, {"label": "C", "text": "Transverse tubules", "correct": false}, {"label": "D", "text": "Desmosomes", "correct": false}], "correct_answer": "A. Gap junctions", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Gap junctions At gap junctions, the intercellular space narrows from 25 nm to 3 nm, and units called Connexons in the membrane of each cell are lined up with one another.</p>\n<p><strong>Highyeild:</strong></p><p>Each connexon is made up of six protein subunits called connexins. They surround a channel that, when lined up with the channel in the corresponding connexon in the adjacent cell, permits substances to pass between the cells without entering the ECF. Gap junctions provide contacts between cells that allow for the direct passage of small molecules between two cells.</p>\n<p><strong>Extraedge:</strong></p><p>Intercalated discs contain three different types of cell-cell junctions Fascia adherens junctions:- Where actin filaments attach thin filaments in the muscle sarcomeres to the cell membrane Expanded desmosomes:- Sites of strong adhesion, that help to keep the muscle cells connected when they contract. Gap junctions:- large and small, which provide direct contact between the cardiac cells, facilitating electrical communication. so that waves of depolarisation spread rapidly over the entire heart , by passing from cell to cell.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Parasympathetic stimulation of the heart accompanied by a withdrawal of sympathetic tone to most of the blood vessels of the body is characteristic of:", "options": [{"label": "A", "text": "The fight-or-flight response", "correct": false}, {"label": "B", "text": "Vasovagal syncope", "correct": true}, {"label": "C", "text": "Exercise", "correct": false}, {"label": "D", "text": "The diving response", "correct": false}], "correct_answer": "B. Vasovagal syncope", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Vasovagal syncope An interesting vasodilatory reaction occurs in people who experience intense emotional disturbances that cause fainting. In this case, the muscle vasodilator system becomes activated and, at the same time, the vagal cardioinhibitory center transmits strong signals to the heart to slow the heart rate markedly. The arterial pressure falls rapidly, which reduces blood flow to the brain and causes the person to lose consciousness. This overall effect is called vasovagal syncope.</p>\n<p><strong>Highyeild:</strong></p><p>Vasovagal syncope occurs when a vagus nerve to the heart overreacts to certain situations like extreme heat, anxiety, hunger, pain, or Blood pressure drops very quickly (orthostatic hypotension), making you feel dizzy or faint. Vasovagal syncope is triggered by an exaggerated sympathetic response to a situation; in other words, sympathoexcitation precedes the onset. The Bezold-Jarisch reflex plays an important role in the onset of this type of syncope.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. The fight or flight response is an automatic physiological reaction to an event that is perceived as stressful or frightening. Option C. Normally during exercise, blood pressure increases to push the flow of oxygen-rich blood throughout the body. Option D. The diving response demonstrates a cessation of breathing, decreased heart rate, and an increase in peripheral vascular resistance leading to a redistribution of blood flow to adequately perfuse the brain and heart.</p>\n<p><strong>Extraedge:</strong></p><p>Activation of chemosensitive vagal C fibers in the cardiopulmonary region (e.g., juxta capillary region of alveoli, ventricles, atria, great veins, and pulmonary artery) causes profound bradycardia, hypotension, and a brief period of apnoea followed by rapid shallow breathing. This response pattern is called the Bezold–Jarisch reflex and can be elicited by a variety of substances including capsaicin, serotonin, phenyl biguanide, and veratridine. The Bezold– Jarisch reflex is activated during certain pathophysiologic conditions. For example, this reflex may be activated during myocardial ischemia and reperfusion as a result of increased production of oxygen radicals and by agents used as radiocontrast for coronary angiography. This can contribute to hypotension which is frequently a stubborn complication of heart disease. Activation of cardiopulmonary chemo-sensitive receptors may also be part of a defense mechanism protecting individuals from toxic chemical hazards. Activation of cardiopulmonary reflexes may help reduce the amount of inspired pollutants that get absorbed into the blood, protecting vital organs from the potential toxicity of these pollutants, and facilitating their elimination. Finally, the syndrome of cardiac slowing with hypotension (vasovagal syncope) has also been attributed to the activation of the Bezold–Jarisch reflex. Vasovagal syncope can occur after prolonged upright posture that results in the pooling of blood in the lower extremities and diminished intracardiac blood volume (also called postural syncope). This phenomenon is exaggerated if combined with dehydration. The resultant arterial hypotension is sensed in the carotid sinus baroreceptors, and afferent fibers from these receptors trigger autonomic signals that increase the cardiac rate and contractility.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 66-year-old man with hypertension has been prescribed a drug that inhibits depolarization of the sinoatrial (SA) node of the heart, thereby decreasing impulse conduction of the atria and ventricles. What is the most likely mechanism of action of this drug?", "options": [{"label": "A", "text": "Beta1-adrenergic agonist", "correct": false}, {"label": "B", "text": "Beta2-adrenergic antagonist", "correct": false}, {"label": "C", "text": "Funny (F) channel agonist", "correct": false}, {"label": "D", "text": "Voltage-dependent Ca2+ channel antagonist", "correct": true}], "correct_answer": "D. Voltage-dependent Ca2+ channel antagonist", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Voltage-dependent Ca2+ channel antagonist Depolarization of the sinoatrial (SA) node occurs via the opening of voltage-dependent Ca2+ channels. A voltage-dependent Ca2+ channel antagonist will reduce the number of calcium channels that open, thus reducing the rate of depolarization of the SA node and the impulse conduction velocity of the atria and ventricles.</p>\n<p><strong>Highyeild:</strong></p><p>Voltage-gated calcium channels (VGCCs) are the predominant source of calcium influx in the heart leading to calcium-induced calcium release and ultimately excitation-contraction coupling. In the heart, VGCCs are modulated by β-adrenergic</p>\n<p><strong>Extraedge:</strong></p><p>CLINICAL INTEGRATION Effect of β1 adrenergic agonist-stimulates β1 receptors, which are located in the SA node, and will increase impulse conduction of the SA node. Effect of β2 adrenergic antagonist -inhibit β2 receptors, which are primarily located in the airways, and block airway dilation. A funny channel agonist will stimulate the current, which will reduce the duration of phase 4 of the slow-phase action potential of the SA node, which will increase the rate of impulse conduction of the SA node. A voltage-dependent K+ channel antagonist will block K+ channels and decrease the rate of depolarization. A voltage-dependent Na+ channel agonist will open more Na+ channels for depolarization of cardiac muscle cells, but not the SA node, which is depolarized by Ca2+ influx.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The conduction pathway through the heart has a normal physiologic delay. In which of the following cardiac conduction tissues does this delay occur?", "options": [{"label": "A", "text": "Atrioventricular node", "correct": true}, {"label": "B", "text": "Bundle of His", "correct": false}, {"label": "C", "text": "Bundle branches", "correct": false}, {"label": "D", "text": "Purkinje fibers", "correct": false}], "correct_answer": "A. Atrioventricular node", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Atrioventricular node The atrial conduction system is organized so that the cardiac impulse does not travel from the atria into the ventricles too rapidly; this delay allows time for the atria to empty their blood into the ventricles before a ventricular contraction begins. It is primarily the A-V node and its adjacent conductive fibers that delay this transmission.</p>\n<p><strong>Highyeild:</strong></p><p>CAUSE OF THE DELAY FROM THE ATRIA TO THE VENTRICLES The impulse, after traveling through the inter-nodal pathways, reaches the A-V node about 0.03 seconds after its origin in the sinus node. Then there is a delay of another 0.09 seconds in the A-V node itself before the impulse enters the penetrating portion of the A-V bundle, where it passes into the ventricles. A final delay of another 0.04 seconds occurs mainly in this penetrating A-V bundle. Thus, the total delay in the A-V nodal and A-V bundle system is about 0.13 seconds. This delay, in addition to the initial conduction delay of 0.03 seconds from the sinus node to the A-V node, makes a total delay of 0.16 seconds before the excitatory signal finally reaches the contracting muscle of the ventricles.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The conduction velocities of cardiac action potentials are measured in a controlled setting at four different locations in the hearts of ten young healthy adults. The following average results are obtained: Location 1-0.035 m/s Location 2-0 .931 m/s Location 3-1.980 m/s Location 4-4 .152 m/s Which of the following is the correct cardiac structure of each measured location?", "options": [{"label": "A", "text": "AV node, atrial myocyte, Bundle branches, Purkinje fibers", "correct": true}, {"label": "B", "text": "Atrial myocyte, AV node, Bundle branches, Purkinje fibers", "correct": false}, {"label": "C", "text": "AV node, atrial myocyte, Purkinje fibers, Bundle branches", "correct": false}, {"label": "D", "text": "AV node, Bundle branches, AV node, Purkinje fibers", "correct": false}], "correct_answer": "A. AV node, atrial myocyte, Bundle branches, Purkinje fibers", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>AV node, atrial myocyte, Bundle branches, Purkinje fibers Conduction velocity is slowest at the atrioventricular (AV) node, in order to complete atrial depolarization before ventricular depolarization. Conduction velocity is fastest at the specialized conduction fibers of the heart (about 4 m/sec for Purkinje fibers and about 2 m/sec for bundle branches).</p>\n<p><strong>Highyeild:</strong></p><p>SPREAD OF CARDIAC EXCITATION Depolarization initiated in the SA node spreads radially through the atria, then converges on the AV node. Atrial depolarization is complete in about 0.1 s. Because conduction in the AV node is slow a delay of about 0.1 s (AV nodal delay) occurs before excitation spreads to the ventricles. From the top of the septum, the wave of depolarization spreads in the rapidly conducting Purkinje fibers to all parts of the ventricles in 0.08-0.1 s. In humans, depolarization of the ventricular muscle starts at the left side of the interventricular septum and moves first to the right across the mid portion of the septum. The wave of depolarization then spreads down the septum to the apex of the heart. It returns along the ventricular walls to the AV groove, proceeding from the endocardial to the epicardial surface. The last parts of the heart to be depolarized are the posterobasal portion of the left ventricle, the pulmonary conus, and the uppermost portion of the septum.</p>\n<p><strong>Extraedge:</strong></p><p>Conduction speed in Cardiac tissues Tissue Conduction Rate (m/s) SA node 0.05 Atrial pathways 1 AV node 0.05 Bundle of His 1 Purkinje system 4 Ventricular muscle 1</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The cell-to-cell conduction of a wave of depolarisation through the atrioventricular (AV) nodal cells of the heart occurs during which segment or interval of the electrocardiogram (ECG) trace?", "options": [{"label": "A", "text": "1", "correct": false}, {"label": "B", "text": "2", "correct": true}, {"label": "C", "text": "3", "correct": false}, {"label": "D", "text": "4", "correct": false}], "correct_answer": "B. 2", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>2 The portion of the ECG trace labeled 2 is the PR interval, which includes the depolarization of the AV nodal cells of the conduction system.</p>\n<p><strong>Highyeild:</strong></p><p>PARTS OF ECG The portion of the ECG trace labeled 1 is the P-wave, which is produced by the depolarization of the atrial muscle cells. The portion of the ECG trace labeled 2 is the PR interval, which includes the depolarization of the AV nodal cells of the conduction system. The portion of the ECG trace labeled 3 is the QRS complex, which is produced by the depolarization of the ventricular muscle cells.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Consider the following statements regarding the ECG: a. P wave is generated by the pacemaker current. b. The PR interval is normally 0.3 seconds. c. The QRS complex coincides with ventricular depolarization. d. Atrial repolarization generates the T wave. e. Exercise shortens the ST interval. All of the following statements are true except: Select the correct answer from the given below code:", "options": [{"label": "A", "text": "c, d, and e", "correct": false}, {"label": "B", "text": "a and d only", "correct": false}, {"label": "C", "text": "a, b, and d", "correct": true}, {"label": "D", "text": "c and e only", "correct": false}], "correct_answer": "C. a, b, and d", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>a, b, and d Statement A. False: The pacemaker current is too small to register. The P wave is generated by atrial muscle depolarization. Statement B. False: The interval is due chiefly to the slow transmission through the AV node , and should not exceed 0.25. An interval of 0.3 s indicates a heart block. Statement C. True: The ventricles represent a large mass of muscle fibers that depolarize almost synchronously. The depolarization current generates a large QRS complex. Statement D. False: The T wave is due to repolarization. Atrial repolarization does not produce a significant deflection of the ECG, as becomes obvious during a complete heart block. Statement E. True: The QT interval depends on the duration of the ventricular action potential. The latter is shortened by sympathetic stimulation during exercise.</p>\n<p><strong>Extraedge:</strong></p><p>P wave = Atrial depolarization. The positive wave of depolarization spreads from the SA node and is conducted throughout the cells of the atria through gap junctions that connect these cells. PR segment = depolarization of the AV node, i.e., when current is passing through the AV node. It’s a flat line because the wave is not strong enough to be recorded on the voltmeter. PR interval = Wave goes over the atrium and through the AV node and ends just before it activates the ventricles to depolarize. Q wave = Ventricular Septal Depolarization R wave = Resultant or major ventricular muscle depolarization. The resultant vector is directed downward and leftward. S Wave = Basal Ventricular depolarization, i.e., depolarization of the base of the ventricles. Note the apex of the heart is the L. pointed end. The base of the ventricles connects to the atria. ST segment = During the ST segment, all the ventricular myocardium is depolarized. All have positive charges. So there is no potential difference to be recorded by the voltmeter (ECG machine). So you have a flat line. The T wave represents ventricular repolarization. QT interval = Important because it captures the beginning of ventricular depolarization through the plateau phase to the ventricular repolarization. It covers the entire ventricular activity. During this time, the action potential was generated and terminated in the ventricular tissue. The beginning of the QRS complex is the start of the ventricular systole and that goes until the end of the T wave. Ventricular diastole starts when the T wave ends. U wave. Sometimes the electrical activity of the ventricular papillary muscle is out of phase with the rest of the ventricles and will record as a “U” wave that shows after the T wave.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 75-year-old woman with a history of chronic congestive heart failure undergoes cardiac catheterization to determine the extent of cardiac dysfunction. During the estimation of her systolic function, in what phase of the cardiac cycle should her peak leave ventricular pressure occur?", "options": [{"label": "A", "text": "Rapid filling", "correct": false}, {"label": "B", "text": "lso-volumetric contraction", "correct": false}, {"label": "C", "text": "Ventricular ejection", "correct": true}, {"label": "D", "text": "Atrial systole", "correct": false}], "correct_answer": "C. Ventricular ejection", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Ventricular ejection Left ventricular pressure rises to a maximum in the phase of ventricular ejection.</p>\n<p><strong>Highyeild:</strong></p><p>VENTRICULAR SYSTOLE At the start of the ventricular systole, the AV valves close. Ventricular muscle initially shortens relatively little, but intraventricular pressure rises sharply as the myocardium presses on the blood in the ventricle. This period of isovolumetric (isovolumic, isometric) ventricular contraction lasts about 0.05 s until dying pressures in the left and right ventricles exceed the pressures in the aorta (80 mm Hg) and pulmonary artery (10 mm Hg) and the aortic and pulmonary valves open. During isovolumetric contraction, the AV valves bulge into the atria, causing a small but sharp rise in atrial pressure. When the aortic and pulmonary valves open, the phase of ventricular ejection begins. Ejection is rapid at first, slowing down as systole progresses. The intraventricular pressure rises to a maximum and then declines somewhat before the ventricular systole ends. Peak pressures in the left and right ventricles are about 120 and 25 mm Hg, respectively. Late in systole, pressure in the aorta exceeds that in the left ventricle, but for a short period momentum keeps the blood moving forward. The AV valves are pulled down by the contractions of the ventricular muscle, and atrial Pressure drops.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Rapid filling – this begins after left atrial pressure has exceeded the pressure within the LV and the mitral valve opens, allowing passive blood flow into the LV. Option B. Isometric contraction is an event occurring in early systole during which the ventricles contract with no corresponding volume change (isometrically). Option D. Atrial systole occurs toward the end of ventricular diastole, completing the filling of the ventricles. In an ECG, atrial systole is associated with atrial depolarization, or the P wave deflection .</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Skeletal muscle tissue can undergo tetanic contractions but cardiac muscle tissue cannot. In comparison to skeletal muscle, what mechanism prevents cardiac muscle tissue from producing a tetanic contraction?", "options": [{"label": "A", "text": "Less intracellular Ca2+ accumulation", "correct": false}, {"label": "B", "text": "Longer absolute refractory period", "correct": true}, {"label": "C", "text": "Slower cross-bridge cycling rate", "correct": false}, {"label": "D", "text": "Slower decline of intracellular Ca2+", "correct": false}], "correct_answer": "B. Longer absolute refractory period", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Longer absolute refractory period The long absolute refractory period (ARP) in cardiac muscle is due to the action potential (AP) plateau phase generated primarily by calcium influx.</p>\n<p><strong>Highyeild:</strong></p><p>Cardiac muscle doesn't go into tetanic contraction due to the effect of calcium ions which are slowly released into the cell during an action potential, prolonging the action potential. As a result, the graph for electrical activity in cardiac cells has a 'plateau' area because of the release of calcium and the decreased membrane permeability to potassium. By the time the action potential is over, the refractory period (channel inactivation period) for the ions is over, and the cardiac cell is relaxed and ready to be excited again. (skeletal action potential = 5-10 msec. cardiac action potential = 250 msec) Since the ARP lasts nearly as long as the muscle contraction itself, the membrane is capable of being stimulated again only after the twitch force has fallen nearly completely. This means that tetanic contraction is prevented despite the functional syncytium of the heart muscle.</p>\n<p><strong>Extraedge:</strong></p><p>ABSOLUTE REFRACTORY PERIOD OF CARDIAC MUSCLE During phases 0 to 2 and about half of phase 3 (until the membrane potential reaches approximately -50 mV during repolarization), cardiac muscle cannot be excited again; that is, it is in its absolute refractory period. It remains relatively refractory until phase 4. Therefore, tetanus of the type seen in skeletal muscle cannot occur.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 35-year-old man has a murmur that ceases with the onset of the second heart sound. The second heart sound occurs at the onset of which phase of the cardiac cycle?", "options": [{"label": "A", "text": "Isovolumetric contraction", "correct": false}, {"label": "B", "text": "Isovolumetric relaxation", "correct": true}, {"label": "C", "text": "Rapid ejection", "correct": false}, {"label": "D", "text": "Rapid ventricular filling", "correct": false}], "correct_answer": "B. Isovolumetric relaxation", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Isovolumetric relaxation Closure of the semilunar valves (aortic and pulmonic valves) marks the beginning of the isovolumetric relaxation phase of the cardiac cycle and is responsible for the second heart sound (S2).</p>\n<p><strong>Highyeild:</strong></p><p>During this brief period (approximately 0.06 seconds), the ventricles are closed, and myocardial relaxation, which began during proto-diastole, continues. Intraventricular pressure falls rapidly, although ventricular volume changes little. When intraventricular pressure falls below atrial pressure, the mitral and tricuspid valves open, and rapid filling of the ventricles begins.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- A: The first heart sound (S1) is created by the closure of the AV valves (tricuspid and mitral) during isovolumetric contraction and occurs during diastole. C: Rapid ejection produces neither S1, nor S2, but can produce a murmur via increased turbulent flow over a narrowed orifice. D: Rapid ventricular filling can produce a gallop rhythm on auscultation with the addition of S3 (sometimes pathological) or S4 (always pathological).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A patient is referred to the Heart Station for exercise stress testing. Baseline and exercise levels of cardiac and venous function are measured and plotted on the graphs below. The point marked Control represents baseline cardiovascular function in the resting state in the supine position. During treadmill exercise, there will be a shift from the resting state to which of the following points?", "options": [{"label": "A", "text": "A", "correct": false}, {"label": "B", "text": "B", "correct": false}, {"label": "C", "text": "C", "correct": true}, {"label": "D", "text": "D", "correct": false}], "correct_answer": "C. C", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>C This diagram depicts cardiac (ventricular) function and venous function curves. With the onset of exercise, there is an increase in contractility, which shifts the cardiac function curve up. Also, accompanying the onset of exercise decreases total peripheral resistance and venous compliance, both of which shift the vascular function curve to the right and increase its slope. The point at which the cardiac function and venous function curves intersect (C) represents the central venous pressure and cardiac output of the cardiovascular system under these conditions.</p>\n<p><strong>Extraedge:</strong></p><p>' Major factors determining peripheral venous pressure, venous return, and stroke volume. Reversing the arrows in the boxes would indicate how these factors can decrease.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A pacemaker is inserted in a patient to shorten the PR interval detected on their ECG. Which of the following events normally occurs during the PR interval?", "options": [{"label": "A", "text": "The ventricle is contracting.", "correct": false}, {"label": "B", "text": "The cardiac action potential passes through the AV node.", "correct": true}, {"label": "C", "text": "There is no change in the voltage tracing on the ECG.", "correct": false}, {"label": "D", "text": "The mitral and aortic valves are both closed.", "correct": false}], "correct_answer": "B. The cardiac action potential passes through the AV node.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The cardiac action potential passes through the AV node. PR Interval detected on ECG when cardiac action potential passes through the AV node.</p>\n<p><strong>Highyeild:</strong></p><p>The PR interval starts at the beginning of the P wave and ends at the beginning of the QRS complex. The physiologic events that occur during this period include atrial depolarization, which is responsible for the P wave, AV nodal depolarization, and depolarization of the bundle of His and the Purkinje fibers. SA nodal depolarization precedes the P wave. Since the mass of the SA node is so small, this event cannot be detected on the standard ECG recording. The mitral and aortic valves are closed during isovolumic contraction, which occurs after the QRS complex has begun. The second heart sound occurs at the end of systole.</p>\n<p><strong>Extraedge:</strong></p><p>The PR interval represents the time between atrial depolarization and ventricular depolarization. A PR interval of under 120 milliseconds (ms) may indicate that electrical impulses are traveling between the atria and ventricles too quickly. A first-degree, or 1st degree, AV block is indicated on the ECG by a prolonged PR interval.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Calcium enters the cardiac cell during which phase?", "options": [{"label": "A", "text": "Rapid upstroke of the action potential", "correct": false}, {"label": "B", "text": "Down slope of the action potential", "correct": false}, {"label": "C", "text": "Plateau phase of the action potential", "correct": true}, {"label": "D", "text": "Slow diastolic depolarization (phase 4) of the action potential", "correct": false}], "correct_answer": "C. Plateau phase of the action potential", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Plateau phase of the action potential</p>\n<p><strong>Highyeild:</strong></p><p>PLATEAU PHASE OF VENTRICULAR ACTION POTENTIAL In phase 2 (plateau), calcium channels open, and fast potassium channels close. Brief initial repolarization occurs and the action potential then plateaus as a result of: Increased calcium ion permeability Decreased potassium ion permeability. The voltage-gated calcium ion channels open slowly during phases 1 and 0, and calcium enters the cell. Potassium channels then close, and the combination of decreased potassium ion efflux and increased calcium ion influx causes the action potential to plateau. The individual fibers are separated by membranes, but membrane depolarization spreads radially through them as if they were a syncytium because of the presence of gap junctions.</p>\n<p><strong>Extraedge:</strong></p><p>PHASES OF VENTRICULAR ACTION POTENTIAL Phase 0: rapid sodium influx: rapid depolarization phase Phase 1: potassium efflux and occurs: partial or early repolarization phase Phase 2: potassium efflux and calcium influx take place: plateau phase Phase 3: potassium efflux takes place: final repolarization phase Phase 4: resting state is attained</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The absolute refractory period is defined as the?", "options": [{"label": "A", "text": "Interval measured from the beginning of the P wave to the beginning of the R wave.", "correct": false}, {"label": "B", "text": "The period between atrial depolarization and activation of the His Purkinje system.", "correct": false}, {"label": "C", "text": "The period that the myocardial cell is unable to generate an action potential in response to another electrical impulse.", "correct": true}, {"label": "D", "text": "None of the above", "correct": false}], "correct_answer": "C. The period that the myocardial cell is unable to generate an action potential in response to another electrical impulse.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The period that the myocardial cell is unable to generate an action potential in response to another electrical impulse.</p>\n<p><strong>Highyeild:</strong></p><p>REFRACTORY PERIOD After the myocardial cell has depolarized, there is a period that the cell cannot generate an action potential in response to another electrical impulse; this is referred to as the \"absolute refractory period.\" As the cell continues to repolarize, an \"effective refractory period\" occurs in which the cell can transiently depolarize in response to an electrical impulse but generally will not develop enough of an action potential to propagate the impulse to surrounding cells. As repolarization nears completion, the cell is said to be in a \"relative refractory period;\" in this period, a strong electrical stimulus can trigger the cell to depolarize and create another action potential.</p>\n<p><strong>Extraedge:</strong></p><p>Force of ventricular contraction, showing also the duration of the refractory period and relative refractory period, plus the effect of premature contraction. Note that premature contractions do not cause wave As occurs in skeletal muscle.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The vagal stimulation will cause an increase in:", "options": [{"label": "A", "text": "Heart rate", "correct": false}, {"label": "B", "text": "R-R interval in ECG", "correct": true}, {"label": "C", "text": "Cardiac output", "correct": false}, {"label": "D", "text": "Force of contraction", "correct": false}], "correct_answer": "B. R-R interval in ECG", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>R-R interval in ECG The increase in PR interval in response to vagal stimulation is well correlated with vagal stimulation frequency.</p>\n<p><strong>Highyeild:</strong></p><p>Stimulation of the parasympathetic nerves to the heart (the vagi) causes the hormone acetylcholine to be released at the vagal endings. This hormone has two major effects on the heart. First, it decreases the rate of the rhythm of the sinus node, and second, it decreases the excitability of the A-V junctional fibers between the atrial musculature and the A-V node, thereby slowing the transmission of the cardiac impulse into the ventricles. Also, remember Strong stimulation of the vagi can stop the rhythmical excitation by the sinus node. The ventricles may stop beating for 5 to 20 seconds, but then some small area in the Purkinje fibers, usually in the ventricular septal portion of the A-V bundle, develops a rhythm of its own and causes ventricular contraction at a rate of 15 to 40 beats per minute. This phenomenon is called a ventricular escape. Sympathetic Stimulation Increases the Cardiac Rhythm and Conduction. First, it increases the rate of sinus nodal discharge. Second, it increases the rate of conduction, as well as the level of excitability in all portions of the heart. Third, it greatly increases the force of contraction of all the cardiac musculature. Normal ECG The P wave is caused by electrical potentials generated when the atria depolarize before an atrial contraction begins. The QRS complex is caused by potentials generated when the ventricles depolarize before contraction, that is, as the depolarization wave spreads through the ventricles. Therefore, both the P wave and the components of the QRS complex are depolarization waves. The T wave is caused by potentials generated as the ventricles recover from the state of depolarization. This process normally occurs in ventricular muscle 0.25 to 0.35 seconds after depolarization. The T wave is known as a repolarization wave.</p>\n<p><strong>Extraedge:</strong></p><p>P wave = Atrial depolarization. The positive wave of depolarization spreads from the SA node and is conducted throughout the cells of the atria through gap junctions that connect these cells. PR segment = depolarization of the AV node, i.e., when current is passing through the AV node. It’s a flat line because the wave is not strong enough to be recorded on the voltmeter. PR interval = Wave goes over the atrium and through the AV node and ends just before it activates the ventricles to depolarize. Q wave = Ventricular Septal Depolarization R wave = Resultant or major ventricular muscle depolarization. The resultant vector is directed downward and leftward. S Wave = Basal Ventricular depolarization, i.e. depolarization of the base of the ventricles. Note the apex of the heart is the L. pointed end. The base of the ventricles connects to the atria. ST segment = During the ST segment, all the ventricular myocardium is depolarized. All have positive charges. So there is no potential difference to be recorded by the voltmeter (ECG machine). So you have a flat line. The T wave represents ventricular repolarization. QT interval = Important because it captures the beginning of ventricular depolarization through the plateau phase to the ventricular repolarization. It covers the entire ventricular activity. During this time, the action potential was generated and terminated in the ventricular tissue. The beginning of the QRS complex is the start of the ventricular systole and that goes until the end of the T wave. Ventricular diastole starts when the T wave ends. U wave. Sometimes the electrical activity of the ventricular papillary muscle is out of phase with the rest of the ventricles and will record as a “U” wave that shows after the T wave.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which is the true statement about AV nodal cells?", "options": [{"label": "A", "text": "Exhibit action potentials characterized by rapid depolarization (phase 0)", "correct": false}, {"label": "B", "text": "Exhibit increased conduction velocity when exposed to acetylcholine", "correct": false}, {"label": "C", "text": "Conduct impulses more slowly than either atrial or ventricular cells", "correct": true}, {"label": "D", "text": "Are capable of pacemaker activity at an intrinsic rate of 100 beats/min", "correct": false}], "correct_answer": "C. Conduct impulses more slowly than either atrial or ventricular cells", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Conduct impulses more slowly than either atrial or ventricular cells The atrial conduction system is organized so that the cardiac impulse does not travel from the atria into the ventricles too rapidly; this delay allows time for the atria to empty their blood into the ventricles before a ventricular contraction begins. It is primarily the A-V node and its adjacent conductive fibers that delay this transmission into the ventricles.</p>\n<p><strong>Highyeild:</strong></p><p>CAUSE OF THE DELAY FROM ATRIA TO THE VENTRICLES The impulse, after traveling through the inter-nodal pathways, reaches the A-V node about 0.03 seconds after its origin in the sinus node. Then there is a delay of another 0.09 seconds in the A-V node itself before the impulse enters the penetrating portion of the A-V bundle, where it passes into the ventricles. A final delay of another 0.04 seconds occurs mainly in this penetrating A-V bundle. Thus, the total delay in the A-V nodal and A-V bundle system is about 0.13 seconds. This delay, in addition to the initial conduction delay of 0.03 seconds from the sinus node to the A-V node, makes a total delay of 0.16 seconds before the excitatory signal finally reaches the contracting muscle of the ventricles.</p>\n<p><strong>Extraedge:</strong></p><p>Conduction speed in Cardiac tissues Tissue Conduction Rate (m/s) SA node 0.05 Atrial pathways 1 AV node 0.05 Bundle of His 1 Purkinje system 4 Ventricular muscle 1</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Pre-potential SA node is due to all except:", "options": [{"label": "A", "text": "Na+ influx", "correct": false}, {"label": "B", "text": "K+ decay", "correct": false}, {"label": "C", "text": "Transient Ca2+ channel opening", "correct": false}, {"label": "D", "text": "Cl- channel closure", "correct": true}], "correct_answer": "D. Cl- channel closure", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Cl- channel closure Pre-potential SA node is due to Sodium ion influx, Potassium decay, and Transient Ca2+ channel opening.</p>\n<p><strong>Highyeild:</strong></p><p>Rhythmically discharging cells have a membrane potential that, after each impulse, declines to the firing level. Thus, this prepotential in pacemaker potential triggers the next impulse. At the peak of each impulse, I K begins and brings about repolarization. I K then declines, and a channel that can pass both Na + and K + is activated. Because this channel is activated following hyperpolarization, it is referred to as an “h” channel; however, because of its unusual (funny) activation, this has also been dubbed an “f” channel. As I h increases, the membrane begins to depolarize, forming the first part of the prepotential. Ca 2+ channels then open.</p>\n<p><strong>Extraedge:</strong></p><p>The tendency for the action potential of cardiac cell membranes to drift towards the threshold following repolarization. Pacemaker cells have a prepotential in pacemaker potential that is never resting. After each impulse, the prepotential gradually reaches a threshold and allows another impulse to occur. This prepotential is brought about by the Ih channels (I=current).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 30 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A 29-year-old Mrs. Bishnoi has regular, infrequent menstrual cycles occurring at an interval of 35-36 days. What is the usual timing of ovulation in this lady?", "options": [{"label": "A", "text": "14 days before menstruation", "correct": true}, {"label": "B", "text": "Just before the LH surge", "correct": false}, {"label": "C", "text": "Just after corpus luteal maturation", "correct": false}, {"label": "D", "text": "22 days before menstruation", "correct": false}], "correct_answer": "A. 14 days before menstruation", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>14 days before menstruation Ovulation occurs 14 days before menses, regardless of cycle length.</p>\n<p><strong>Highyeild:</strong></p><p>If we calculate the day of menstruation from the beginning of the cycle, in a 28-day cycle, ovulation occurs on day 14, and in a 35-day cycle, ovulation will occur on day 22.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B: LH surge leads to ovulation. Ovulation does not occur before LH surge . Option C: The ruptured ovarian follicle (after ovulation) is converted into corpus luteum . Ovulation does not occur after corpus luteal maturation. Option D: Ovulation will occur 14 days before menstruation , i.e., on day 22 of a 35-day cycle. It does not occur 22 days before menstruation.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following is the dominant hormone in the luteal phase?", "options": [{"label": "A", "text": "Estrogen", "correct": false}, {"label": "B", "text": "Progesterone", "correct": true}, {"label": "C", "text": "Prolactin", "correct": false}, {"label": "D", "text": "Oxytocin", "correct": false}], "correct_answer": "B. Progesterone", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Progesterone Progesterone is the dominant hormone during the luteal phase.</p>\n<p><strong>Highyeild:</strong></p><p>The corpus luteum in the non-pregnant woman secretes large quantities of progesterone and a small amount of estrogen, as well as inhibin. In terms of ovarian function, the menstrual cycle may be divided into two phases approximately equal in length and separated by ovulation:- The follicular phase, during which a mature follicle and secondary oocyte develop; and The luteal phase begins after ovulation and lasts until the death of the corpus luteum.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest options are incorrect because Progesterone is the dominant hormone during the luteal phase.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following hormones is responsible for the maintenance of endometrial thickness in the post-ovulatory phase?", "options": [{"label": "A", "text": "Estrogen", "correct": false}, {"label": "B", "text": "Progesterone", "correct": true}, {"label": "C", "text": "LH", "correct": false}, {"label": "D", "text": "FSH", "correct": false}], "correct_answer": "B. Progesterone", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Progesterone Progesterone is mainly responsible for the maintenance of endometrial thickness in the post-ovulatory phase.</p>\n<p><strong>Highyeild:</strong></p><p>The menstrual cycle consists of three phases: the menstrual phase, the proliferative phase, and the secretory, or progestational phase. Menstrual phase: This phase is characterized by the discharge of blood and endometrial debris from the vagina. It coincides with the end of the ovarian luteal phase and the onset of a new follicular phase. Withdrawal of progesterone on the degeneration of the corpus luteum (CL) leads simultaneously to sloughing of the endometrium (menstruation) and the development of new follicles in the ovary under the influence of rising gonadotropic hormone levels. Proliferative Phase: Thus, menstrual flow ceases, and the proliferative phase of the uterine cycle begins concurrently with the last portion of the ovarian follicular phase. When the menstrual flow ceases, a thin endometrial layer less than 1 mm thick remains. Estrogen stimulates the proliferation of epithelial cells, glands, and blood vessels in the endometrium, increasing this lining to a thickness of 3 to 5 mm. The estrogen-dominant proliferative phase lasts from the end of menstruation to ovulation. Peak estrogen levels trigger the luteinizing hormone (LH) surge responsible for ovulation. Secretory or Progestational Phase: After ovulation, when a new corpus luteum is formed, the uterus enters the secretory, or progestational, phase, which coincides in time with the ovarian luteal phase. The corpus luteum secretes large amounts of progesterone and estrogen. Progesterone converts the thickened, estrogen-primed endometrium to a richly vascularized, glycogen-filled tissue. This period is called either the secretory phase because the endometrial glands are actively secreting glycogen into the uterine lumen for early nourishment of a developing embryo before it implants, or the progestational (\"before pregnancy\") phase, referring to the development of a lush endometrial lining capable of supporting an early embryo after implantation. If fertilization and implantation do not occur, the corpus luteum degenerates and a new follicular phase and menstrual phase begin again.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest all options are explained in the Highyield section</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Positive feedback action of estrogen for inducing luteinizing hormone surge is associated with which of the following steroid hormone ratio in peripheral circulation?", "options": [{"label": "A", "text": "High estrogen: low progesterone", "correct": true}, {"label": "B", "text": "Low estrogen: high progesterone", "correct": false}, {"label": "C", "text": "High estrogen: high progesterone", "correct": false}, {"label": "D", "text": "Low estrogen: low progesterone", "correct": false}], "correct_answer": "A. High estrogen: low progesterone", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>High estrogen: low progesterone The feedback action of estrogen for inducing luteinizing hormone (LH) surge is associated with high estrogen: low progesterone .</p>\n<p><strong>Highyeild:</strong></p><p>Phases Hormone Type of feedback Site FSH and LH secretion Follicular Estrogen Negative Anterior pituitary Both suppressed Midcycle Estrogen Positive Anterior pituitary Increased LH surge Luteal Estrogen Progesterone Negative Negative Anterior pituitary Anterior pituitary Both are decreased</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest options are inappropriate and already explained in the High Yield section that’s why.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following best explains the mechanism behind an increase in LH secretion just before ovulation?", "options": [{"label": "A", "text": "Positive feedback by progesterone", "correct": false}, {"label": "B", "text": "Positive feedback by estrogen", "correct": true}, {"label": "C", "text": "Positive feedback by FSH", "correct": false}, {"label": "D", "text": "Positive feedback by relaxin", "correct": false}], "correct_answer": "B. Positive feedback by estrogen", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Positive feedback by estrogen Increased luteinizing hormone (LH) secretion just before ovulation is due to positive feedback by estrogen .</p>\n<p><strong>Highyeild:</strong></p><p>Phases Hormone Type of feedback Site FSH and LH secretion Follicular Estrogen Negative Anterior pituitary Both suppressed Midcycle Estrogen Positive Anterior pituitary Increased LH surge Luteal Estrogen Progesterone Negative Negative Anterior pituitary Anterior pituitary Both are decreased</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest options are inappropriate and already explained in the High Yield section that’s why.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Corpus luteum of pregnancy is maintained by:", "options": [{"label": "A", "text": "Estrogen", "correct": false}, {"label": "B", "text": "Progesterone", "correct": false}, {"label": "C", "text": "Oxytocin", "correct": false}, {"label": "D", "text": "HCG", "correct": true}], "correct_answer": "D. HCG", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>HCG Human chorionic gonadotropin (HG) causes the persistence of the corpus luteum and prevents menstruation in pregnancy.</p>\n<p><strong>Highyeild:</strong></p><p>The fate of the corpus luteum If the ovum is not fertilized, about 2 days before the end of the monthly cycle, the corpus luteum in the ovary involutes. If fertilization occurs, under the influence of human chorionic gonadotropin , the corpus luteum in the mother's ovary grows to about twice its initial size by a month or so after pregnancy begins. The corpus luteum secretes estrogens and progesterone and maintains the decidual nature of the uterine endometrium, which is necessary for the early development of the fetus. The corpus luteum of pregnancy involutes slowly after the 13th to 17th week of gestation. After that time, the placenta secretes sufficient quantities of progesterone and estrogens to maintain pregnancy for the remainder of the gestation period.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- The Corpus luteum of pregnancy is maintained by HCG. Rest Options are incorrect.</p>\n<p><strong>Extraedge:</strong></p><p>Basic Physiology of pregnancy:- Fertilization (conception) most commonly occurs in the upper end of the fallopian tube (the ampulla). Occurs within 1 day of ovulation. Implantation in the uterine wall occurs 6 days after fertilization. Syncytiotrophoblasts secrete hCG, which is detectable in blood 1 week after fertilization and on home urine tests 2 weeks after fertilization. Embryonic/developmental age-time since fertilization. Used in embryology. Gestational age-time since the first day of the last menstrual period. Used clinically. Gravidity (\"gravida\")-number of pregnancies. Parity (\"para\"-number of pregnancies that resulted in live births. Placental hormone secretion generally increases over the course of pregnancy, but hCG peaks at 8-10 weeks of gestation.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 16 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A patient with congestive heart failure, orthopnea, and paroxysmal nocturnal dyspnea is referred for pulmonary function testing in the supine and upright positions. Which of the following is higher at the apex of the lung than at the base when a person is upright?", "options": [{"label": "A", "text": "Ventilation", "correct": false}, {"label": "B", "text": "Blood flow", "correct": false}, {"label": "C", "text": "V/Q ratio", "correct": true}, {"label": "D", "text": "PaCO2", "correct": false}], "correct_answer": "C. V/Q ratio", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>V/Q ratio When a person is upright, blood flow is higher at the base of the lung due to the effect of gravity. Ventilation, or the amount of air that reaches the alveoli, is also higher at the base of the lung due to increased compliance and decreased resistance in the lower airways.</p>\n<p><strong>Highyeild:</strong></p><p>The alveoli at the apex of the lung are larger than those at the base, so their compliance is less. Because the compliance is reduced, less inspired gas goes to the apex than to the base. Also, because the apex is above the heart, less blood flows through the apex than through the base. However, the reduction in airflow is less than the reduction in blood flow, so the V ˙/Q ˙ ratio at the top of the lung is greater than it is at the bottom. The increased V ˙/Q ˙ ratio at the apex makes PaCO2 lower and PaO2 higher at the apex than they are at the base. Ventilation is highest at the base of the lung due to the higher alveolar compliance there. But the V/Q ratio is higher at the apex (ventilation is lower at the apex and higher at the base but the regional difference isn't as huge for ventilation as it is for perfusion), so the gas exchange is more efficient at the apex, and results in the highest PO2 in the lung (and lower PCO2) when compared to the base. The reason for this is that at the start of inspiration, intrapleural pressure is less negative at the base than at the apex, and since the intrapulmonary intrapleural pressure difference is less than at the apex, the lung is less expanded.</p>\n<p><strong>Extraedge:</strong></p><p>The V/Q ratio is higher at the apex of the lung compared to the base when a person is upright. This is because ventilation is relatively greater at the apex compared to blood flow. In congestive heart failure, there is impaired blood flow due to the weakened heart, and this can lead to ventilation-perfusion mismatch, with decreased V/Q ratio. By performing pulmonary function testing in both supine and upright positions, the effect of gravity on lung function can be assessed.</p>\n<p><strong>Table:</strong></p><p>Ventilation/perfusion mismatch Ideally, ventilation (V) is matched to perfusion (Q) per minute (ie,\n dot V / dot Oratio = 1 ) for adequate gas exchange. Lung zones: VIO at apex of lung = 3 (wasted ventilation) VIO at base of lung = 0.6 (wasted perfusion) Both ventilation and\n perfusion are greater at the base of the lung than at the apex of the lung.\n With exercise (t cardiac output), there is vasodilation of apical capillaries\n dot V / O ratio approaches 1. Certain organisms that thrive in high O_{2} (eg, TB) flourish in the\n apex. dot V / dot Q =0=^ `` oirway \" obstruction (shunt). In shunt,\n 100% O_{2} does not improve Pao, (eg, foreign body aspiration). dot V / dot O = ∞ = blood flow obstruction (physiologic dead space).\n Assuming < 100% dead space, 100% O_{2} improves Pao, (eg, pulmonary\n embolus).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A healthy 26-year-old woman undergoes pulmonary exercise stress testing prior to starting a training regimen in preparation for her first marathon. Normally, during moderate aerobic exercise, which of the following occurs?", "options": [{"label": "A", "text": "Alveolar ventilation increases", "correct": true}, {"label": "B", "text": "Arterial pH decreases", "correct": false}, {"label": "C", "text": "Arterial lactate level increases", "correct": false}, {"label": "D", "text": "PaCO2 decreases", "correct": false}], "correct_answer": "A. Alveolar ventilation increases", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Alveolar ventilation increases During moderate aerobic exercise, oxygen consumption and CO2 production increase, and alveolar ventilation increases in proportion.</p>\n<p><strong>Highyeild:</strong></p><p>During moderate aerobic exercise, there is an increased demand for oxygen by the working muscles. In response, alveolar ventilation increases, allowing more oxygen to enter the lungs and more carbon dioxide to be removed from the body. This is accomplished by an increase in both tidal volume (the volume of air breathed in and out with each breath) and respiratory rate (the number of breaths per minute).</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B & C: Arterial pH and blood lactate concentration are also normal during moderate aerobic exercise, but during anaerobic exercise, which is reached at workloads that exceed approximately 60% of the maximal workload (called the anaerobic threshold), there is increased production of muscle lactic acid, which spills over into the circulation, causing an increase in the concentration of arterial lactate and a decrease in the pH of the blood. Option D: During moderate aerobic exercise, oxygen consumption and CO2 production increase, thus, PaCO2 (and PaO2) do not change.</p>\n<p><strong>Table:</strong></p><p>Ventilation/perfusion\n mismatch Ideally,\n ventilation (V) is matched to perfusion (Q) per minute (ie, dot V / dot\n Oratio = 1 ) for adequate gas exchange. Lung\n zones: VIO at\n apex of lung = 3 (wasted ventilation) VIO at\n base of lung = 0.6 (wasted perfusion) Both ventilation and perfusion are\n greater at the base of the lung than at the apex of the lung. With exercise\n (t cardiac output), there is vasodilation of apical capillaries dot V / O\n ratio approaches 1. Certain\n organisms that thrive in high O_{2} (eg, TB) flourish in the apex. dot V /\n dot Q =0=^ `` oirway \" obstruction (shunt). In shunt, 100% O_{2} does\n not improve Pao, (eg, foreign body aspiration). dot V /\n dot O = ∞ = blood flow obstruction (physiologic dead space). Assuming <\n 100% dead space, 100% O_{2} improves Pao, (eg, pulmonary embolus).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Ventilation-perfusion Ratio is maximum in:", "options": [{"label": "A", "text": "Base of lung", "correct": false}, {"label": "B", "text": "Apex of lung", "correct": true}, {"label": "C", "text": "Post lobe of the lung", "correct": false}, {"label": "D", "text": "Middle lobe of the lung", "correct": false}], "correct_answer": "B. Apex of lung", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Apex of lung Ventilation-perfusion ratio (V/Q ratio) is the ratio of the amount of air reaching the alveoli (ventilation) to the amount of blood perfusing the alveoli (perfusion). The V/Q ratio is not uniform throughout the lung, and it varies from the apex (top) to the base (bottom) of the lung.</p>\n<p><strong>Highyeild:</strong></p><p>In a healthy individual in an upright position, ventilation is greater at the base of the lung than at the apex due to the effect of gravity. At the same time, blood flow is also greater at the base of the lung due to hydrostatic pressure. Therefore, the V/Q ratio is highest (i.e., ventilation is relatively greater compared to perfusion) at the base of the lung.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A is correct, and the V/Q ratio is maximum at the base of the lung. Rest Options are incorrect because the V/Q ratio is lowest (i.e., perfusion is relatively greater compared to ventilation) at the apex of the lung due to the lower blood flow and higher ventilation compared to the base of the lung.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 13 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A 53-year-old woman with chronic lung disease was experiencing difficulty in breathing. Her PaO2 and PaCO2 were 50 mm Hg and 60 mm Hg respectively. Peripheral chemoreceptors central chemoreceptors are respectively sensitive to?", "options": [{"label": "A", "text": "Small increases in PaCO2 and small decreases in local partial pressure of O2", "correct": false}, {"label": "B", "text": "Small decreases in PaCO2 and small increases in local partial pressure of O2", "correct": false}, {"label": "C", "text": "Small decreases in PaO2 and small increases in local partial pressure of CO2", "correct": true}, {"label": "D", "text": "Small increases in PaO2 and small decreases in local partial pressure of CO2", "correct": false}], "correct_answer": "C. Small decreases in PaO2 and small increases in local partial pressure of CO2", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Small decreases in PaO2 and small increases in local partial pressure of CO2 In the case of the 53-year-old woman with chronic lung disease, her PaO2 is lower than normal (the normal range is 75-100 mm Hg), indicating that there may be hypoxemia (low oxygen levels) present. Peripheral chemoreceptors are primarily sensitive to small decreases in PaO2 and small increases in local partial pressure of CO2, while central chemoreceptors are primarily sensitive to small increases in PaCO2.</p>\n<p><strong>Highyeild:</strong></p><p>Peripheral arterial chemoreceptors in the carotid and aortic bodies are exposed to a very high rate of blood flow. These receptors are primarily activated by a reduction in arterial partial pressure of oxygen (PaO2), but they also respond to an increase in the arterial pressure of carbon dioxide (PaCO2) and pH. When the intracranial pressure is increased, the blood supply to the brain is compromised and Local Hypercapnia activates central chemoreceptors located along the ventrolateral medullary surface. Their activation induces a rise in systemic arterial pressure (Cushing reflex) that tends to restore the blood flow to the brain. The rise in BP causes a reflex decrease in heart rate via the arterial baroreceptors. This is why bradycardia and not tachycardia is seen in patients with Increased Intracranial Pressure: called Cushing’s reflex.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Only Option C is the correct answer as it describes the response of peripheral chemoreceptors to small decreases in PaO2 and central chemoreceptors to small increases in Rest options are incorrect</p>\n<p><strong>Extraedge:</strong></p><p>Hypoxia ↓O, delivery to tissues. Commonly due to cardiac output, hypoxemia, ischemia, anemia, CO/ cyanide poisoning. Mechanism of hypoxia: NORMAL A-a GRADIENT INCREASED A-a GRADIENT ↓inspired oxygen tension (Pio 2 )- PIO, FIO, x (P B - P H₂O ); most commonly = due to ↓PB in high altitude Hypoventilation (due to increased Paco)- PAO 2 = PIO 2 , Paco, /RQ (eg, CNS depression, = obesity hypoventilation syndrome, muscular weakness) Diffusion limitation (eg, fibrosis) VIQ mismatch-normal perfusion in areas of decreased ventilation Right-to-left shunt-normal perfusion in areas of no ventilation. Can be anatomic (eg, intracardiac shunt) or physiologic (eg, perfusion of nonventilated alveoli in ARDS) Hypoxemia Insufficient oxygenation of blood (↓ Pao 2 ).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 29-year-old woman presents at the obstetrician/gynecologist’s office with breast tenderness. She’s concerned she may have a lump because her mother had breast cancer, and reports that she can’t be pregnant because she just finished her menstrual period about 2 weeks ago. An assay for human chorionic gonadotropin (hCG) in her urine is positive, confirming pregnancy. In the developing fetus, which vessel has the greatest partial pressure of oxygen?", "options": [{"label": "A", "text": "Umbilical vein", "correct": true}, {"label": "B", "text": "Umbilical arteries", "correct": false}, {"label": "C", "text": "Aorta", "correct": false}, {"label": "D", "text": "Ductus arteriosus", "correct": false}], "correct_answer": "A. Umbilical vein", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Umbilical vein In the developing fetus, the umbilical vein has the highest partial pressure of oxygen , compared to other fetal vessels. Therefore, the correct answer is A) Umbilical vein.</p>\n<p><strong>Highyeild:</strong></p><p>During fetal development, the umbilical vein carries oxygenated blood from the placenta to the developing fetus. The oxygenated blood from the placenta has a higher partial pressure of oxygen (PO2) compared to the deoxygenated blood returning to the placenta through the umbilical arteries. The umbilical vein enters the fetal circulation through the liver and then joins the inferior vena cava, which carries it to the right atrium of the fetal heart. From there, the oxygenated blood is pumped to the left side of the heart and then distributed to the body.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A: is the correct answer as it describes the oxygenated blood supply to the developing fetus via the umbilical vein. Option B & C: The PO2 in the left ventricular outflow tract going to the ascending aorta is ~25 mmHg. The PO2 in the ductus arteriosus is ~18 mmHg, and blood in the descending aorta and umbilical arteries is ~20 mmHg with an oxygen saturation of ~60%. Option D: The ductus venosus has only a slightly lower PO2, and serves to direct much of the highly oxygenated blood from the umbilical vein to the inferior vena cava, bypassing the liver. From the right atrium, about two-thirds of the inferior vena caval flow (67% O2 saturation) is diverted across the foramen ovale to the left atrium.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 28-year-old man is admitted to the Emergency Department with multiple fractures suffered in a car accident. Arterial blood gasses are ordered while the patient is breathing room air. After obtaining the arterial blood sample, the blood-gas technician draws room air into the syringe before measuring the blood-gas values. As a result, which of the following is true?", "options": [{"label": "A", "text": "The measured values of both PaO2 and PaCO2 will be higher than the patient’s actual values", "correct": false}, {"label": "B", "text": "The measured values of both PaO2 and PaCO2 will be lower than the patient’s actual values", "correct": false}, {"label": "C", "text": "The measured PaO2 will be higher and the measured PaCO2 will be lower than the patient’s actual blood gas values", "correct": true}, {"label": "D", "text": "The measured PaO2 will be lower and the measured PaCO2 will be higher than the patient’s actual blood gas values", "correct": false}], "correct_answer": "C. The measured PaO2 will be higher and the measured PaCO2 will be lower than the patient’s actual blood gas values", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The measured PaO2 will be higher and the measured PaCO2 will be lower than the patient’s actual blood gas values Room air contains 21% O2 and 0.04% CO2, yielding a PIO2 of 160 mmHg and a PICO2 of 0.3 mmHg. Thus, if a sample of arterial blood is equilibrated with room air, the measured Pao2 will have an inaccurately high reading and the PaCO2 will have an inaccurately low reading.</p>\n<p><strong>Highyeild:</strong></p><p>For this reason, collecting an anaerobic blood sample is critical in blood gas analysis. Also, once the sample is obtained, the syringe should be placed in a container of crushed ice to prevent any metabolism by the red blood cells, which can also affect the accuracy of the readings. In addition to being certain that an air bubble is not left in the syringe, it is best to use a glass rather than a plastic syringe because the arterial pressure will pump the blood sample into a glass syringe without requiring aspiration, and glass is more impermeable to the diffusion of gasses than plastic. A plastic syringe is permissible if one is drawing the blood sample from an arterial line rather than doing an arterial stick and if the sample is promptly analyzed.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. is incorrect because drawing room air into the syringe before measuring the blood-gas values can lead to a higher measured PaO2 value but a lower measured PaCO2 value. Option B. is incorrect because drawing room air into the syringe before measuring the blood-gas values can lead to a higher measured PaO2 value due to the extra oxygen in the room air. Option D. is incorrect because drawing room air into the syringe before measuring the blood-gas values can lead to a higher measured PaO2 value due to the extra oxygen in the room air. The correct answer is option C, as drawing room air into the syringe before measuring the blood-gas values can lead to a higher measured PaO2 value and a lower measured PaCO2 value, which is opposite to option D.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A medical student waiting to do her first patient interview at the Clinical Skills Center becomes very anxious and increases her rate of alveolar ventilation. If her rate of CO2 production remains constant, which of the following will decrease?", "options": [{"label": "A", "text": "pH", "correct": false}, {"label": "B", "text": "PaO2", "correct": false}, {"label": "C", "text": "PaCO2", "correct": true}, {"label": "D", "text": "V˙/Q˙", "correct": false}], "correct_answer": "C. PaCO2", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>PaCO2 Because the dead space air does not participate in gas exchange, the entire output of CO2 in the expired gas comes from the alveolar gas. Accordingly, CO2 output (VCO2) can be expressed in terms of alveolar ventilation (VA) and alveolar PCO2 according to the equation: PaCO2 = VCO2/VA Thus, an increase in alveolar ventilation at a constant rate of carbon dioxide production will lower PaCO2.</p>\n<p><strong>Highyeild:</strong></p><p>Anxiety can stimulate the sympathetic nervous system, leading to an increase in respiratory rate and depth, which increases alveolar ventilation. This results in a decrease in the partial pressure of carbon dioxide (PaCO2) in arterial blood, as more CO2 is eliminated from the lungs. The rate of CO2 production is assumed to remain constant in this case, so the decrease in PaCO2 is due to an increase in alveolar ventilation.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option C : PaCO2, will decrease in this scenario. The other options are not directly affected by changes in respiratory rate and depth. Hyperventilation increases PaO2 and PaO2, with no change in the alveolar-arterial PaO2 The V/Q would be normal or increased.</p>\n<p><strong>Extraedge:</strong></p><p>The decrease in PaCO2 leads to respiratory alkalosis, which can cause symptoms such as light-headedness, dizziness, and tingling in the fingers and toes. Hypoxia ↓O, delivery to tissues. Commonly due to cardiac output, hypoxemia, ischemia, anemia, CO/ cyanide poisoning. Mechanism of hypoxia: NORMAL A-a GRADIENT INCREASED A-a GRADIENT ↓inspired oxygen tension (Pio 2 )- PIO, FIO, x (P B - P H₂O ); most commonly = due to ↓PB in high altitude Hypoventilation (due to increased Paco)- PAO 2 = PIO 2 , Paco, /RQ (eg, CNS depression, = obesity hypoventilation syndrome, muscular weakness) Diffusion limitation (eg, fibrosis) VIQ mismatch-normal perfusion in areas of decreased ventilation Right-to-left shunt-normal perfusion in areas of no ventilation. Can be anatomic (eg, intracardiac shunt) or physiologic (eg, perfusion of nonventilated alveoli in ARDS) Hypoxemia Insufficient oxygenation of blood (↓ Pao 2 ).</p>\n<p><strong>Table:</strong></p><p>Oxygen content of blood O 2 content =( O , bound to hemoglobin) + (O 2 solubilized in plasma)\n= (1.34HbSa*O 2 +(0.003 blood * Pa*O_{2} ) . Sao, percent saturation of arterial blood with O_{2} 0.003 = solubility constant of O_{2} Pao, = partial pressure of O_{2} in\narterial blood. Normally 1 g Hb can bind 1.34 mL O_{2} normal Hb amount in blood is 15\ng/dL. O_{2} binding (carrying) capacity≈ approx 20 mL O_{2} / d * L of blood. WithHb there is ↓ O_{2} content of arterial blood, but no change in\nO_{2} saturation and Pao,. O_{7} delivery to tissues = cardiac output x O_{2}\ncontent of blood. Hb CONCENTRATION Sao Pao TOTAL O, CONTENT CO poisoning Normal Normal ↓ Anemia ↓ Normal Normal ↓ Polycythemia ↑ Normal Normal ↑ Methemoglobinemia Normal ↓F e 3+ poor at binding O₁) Normal ↓ Cyanide toxicity Normal Normal Normal Normal</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 36-year-old man visits his doctor because his wife has long complained of his snoring, but recently observed that his breathing stops for a couple of minutes at a time while he is sleeping. He undergoes polysomnography and ventilatory response testing to ascertain the extent and causes of his sleep apnea. The activity of the central chemoreceptors is stimulated by which of the following?", "options": [{"label": "A", "text": "An increase in the PCO2 of blood flowing through the brain", "correct": true}, {"label": "B", "text": "A decrease in the PO2 of blood flowing through the brain", "correct": false}, {"label": "C", "text": "An increase in the pH of the CSF", "correct": false}, {"label": "D", "text": "A decrease in the metabolic rate of the surrounding brain tissue", "correct": false}], "correct_answer": "A. An increase in the PCO2 of blood flowing through the brain", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>An increase in the PCO2 of blood flowing through the brain In the given scenario, an increase in PCO2 due to obstructive sleep apnea (OSA) could stimulate the central chemoreceptors, leading to an increase in respiratory drive and an increase in alveolar ventilation during the night.</p>\n<p><strong>Highyeild:</strong></p><p>The central chemoreceptors, located in the medulla oblongata, are primarily responsible for regulating the respiratory drive by responding to changes in the partial pressure of carbon dioxide (PCO2) and pH in the cerebrospinal fluid (CSF) that bathes them. When the PCO2 increases, carbon dioxide diffuses across the blood-brain barrier and into the CSF, leading to an increase in the concentration of H+ ions and a decrease in pH. Polysomnography and ventilatory response testing are common diagnostic tools used to evaluate the severity of OSA and its effect on ventilation during sleep.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Options B, C, and D are not directly related to the stimulation of central chemoreceptors in the medulla oblongata.</p>\n<p><strong>Extraedge:</strong></p><p>The central chemoreceptors, located at or near the ventral surface of the medulla, are stimulated to increase ventilation by a decrease in the pH of their extracellular fluid (ECF). The pH of this ECF is affected by the PCO2 of the blood supply to the medullary chemoreceptor area, as well as by the CO2 and lactic acid production of the surrounding brain tissue. The central chemoreceptors are not stimulated by decreases in PaO2 or blood oxygen content but rather can be depressed by long-term or severe decreases in oxygen supply.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A woman found comatose in her house is life-flighted to the nearest regional medical center. Blood gasses reveal a normal PaO2 but a lower-than-normal arterial O2 saturation. Which of the following conditions is most consistent with the findings?", "options": [{"label": "A", "text": "Anemia", "correct": false}, {"label": "B", "text": "Carbon monoxide poisoning", "correct": true}, {"label": "C", "text": "Low V/Q ratio", "correct": false}, {"label": "D", "text": "Hypoventilation", "correct": false}], "correct_answer": "B. Carbon monoxide poisoning", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Carbon monoxide poisoning In the given scenario, the most likely cause of hypoxemia with a normal PaO2 and low arterial O2 saturation is carbon monoxide poisoning.</p>\n<p><strong>Highyeild:</strong></p><p>Carbon monoxide (CO) poisoning is a common cause of hypoxemia with a normal partial pressure of oxygen (PaO2) and low arterial O2 saturation. CO has a higher affinity for hemoglobin than oxygen, and it forms a stable compound called carboxyhemoglobin, which prevents oxygen from binding to hemoglobin. As a result, the arterial O2 saturation is decreased despite a normal PaO2.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Anemia, low V/Q ratio, and hypoventilation can also cause hypoxemia , but they typically result in a decreased PaO2 as well. Option A. In anemia, the amount of hemoglobin available to bind with oxygen is reduced, resulting in a decreased oxygen-carrying capacity and a decreased PaO2. Option C. In a low V/Q ratio, ventilation and perfusion are mismatched , leading to a decreased PaO2. Option D . In hypoventilation, alveolar ventilation is decreased, leading to an increased PaCO2 and a decreased PaO2.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 44-year-old female undergoing laparoscopic cholecystectomy under general anesthesia. The following graph is obtained while monitoring during the surgery. What is the graph depicting?", "options": [{"label": "A", "text": "O2", "correct": false}, {"label": "B", "text": "CO", "correct": false}, {"label": "C", "text": "NO", "correct": false}, {"label": "D", "text": "CO2", "correct": true}], "correct_answer": "D. CO2", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>CO2 Given graph capnograph detecting CO2 levels from expired air. Lipid-soluble substances can easily cross cell membranes. Fat-soluble substances, such as oxygen, carbon dioxide, and alcohol can penetrate this portion of the membrane with ease.</p>\n<p><strong>Highyeild:</strong></p><p>A capnograph provides a picture of the patient’s cardio-respiratory system in the form of the CO2 waveform which provides clinicians with invaluable information. Viewing a numerical End Tidal CO2 value without the waveform is analogous to viewing the heart rate without the ECG trace.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A: O2 is measured using a pulse oximeter. Option B: DLCO- Diffusion capacity of lungs with carbon monoxide. CO has more affinity to bind with hemoglobin, therefore, helping to diagnose any pathology which is altering the diffusion mechanism at the alveolar level. Option C: NO-Expired nitric oxide is tested in cases of asthma by FENO (fraction of exhaled nitric oxide)</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Cyanosis which is not corrected by 100% oxygen therapy is due to:", "options": [{"label": "A", "text": "Chronic obstructive pulmonary disease", "correct": false}, {"label": "B", "text": "Bronchial asthma", "correct": false}, {"label": "C", "text": "Tetralogy of folate", "correct": true}, {"label": "D", "text": "Interstitial lung disease", "correct": false}], "correct_answer": "C. Tetralogy of folate", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Tetralogy of folate Of the options given, the most likely cause of cyanosis that is not corrected by 100% oxygen therapy is option C: TOF (Tetralogy of Fallot), which is a congenital heart defect that causes a right-to-left shunt of blood due to a combination of the ventricular septal defect (VSD), pulmonary stenosis, and an overriding aorta. In TOF, blood from the right ventricle is shunted directly into the aorta without passing through the lungs, leading to cyanosis.</p>\n<p><strong>Highyeild:</strong></p><p>Cyanosis is a bluish discoloration of the skin and mucous membranes that result from an increased concentration of deoxygenated hemoglobin in the blood vessels near the skin surface. Cyanosis that is not corrected by 100% oxygen therapy suggests that the underlying condition is causing a right-to-left shunt of blood, which means that blood is bypassing the lungs and entering the systemic circulation without being oxygenated.</p>\n<p><strong>Random:</strong></p><p>Explanation for incorrect options: - Option A (chronic obstructive pulmonary disease), Option B (bronchial asthma) , and Option D (interstitial lung disease) are all respiratory conditions that can cause low oxygen saturation in the blood, but they are not typically associated with right-to-left shunting and therefore, are less likely to cause cyanosis that is not corrected by 100% oxygen therapy.</p>\n<p><strong>Table:</strong></p><p>Caused by anterosuperior displacement of the infundibular septum. Most\ncommon cause of early childhood cyanosis. 1 Pulmonary infundibular stenosis (most important\ndeterminant for prognosis) 2 Right ventricular hypertrophy (RVH)- boot-shaped heart on CXR B 3 Overriding aorta 4 VSD Pulmonary stenosis forces right-to-left flow across VSD→ RVH, \"tet\nspells\" (often caused by crying, fever, and exercise due to exacerbation\nof RV outflow obstruction).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Cause of the sigmoid shape of the O2 curve?", "options": [{"label": "A", "text": "The binding of one O2 molecule increases the affinity of binding of other O2 molecules", "correct": true}, {"label": "B", "text": "The binding of one O2 molecule decreases the affinity of binding of other O2 molecules", "correct": false}, {"label": "C", "text": "Bohr effect", "correct": false}, {"label": "D", "text": "Haldane effect", "correct": false}], "correct_answer": "A. The binding of one O2 molecule increases the affinity of binding of other O2 molecules", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The binding of one O2 molecule increases the affinity of binding of other O2 molecules The sigmoid shape of the O2 (oxygen) dissociation curve is due to option A: The binding of one O2 molecule increases the affinity of binding of other O2 molecules.</p>\n<p><strong>Highyeild:</strong></p><p>The sigmoid shape of the O2 dissociation curve represents the cooperative binding of O2 to hemoglobin molecules in the red blood cells. Hemoglobin can exist in different states of oxygenation, depending on the presence or absence of O2 molecules. The binding of the first O2 molecule to hemoglobin induces a conformational change in the protein, making it easier for additional O2 molecules to bind to the remaining heme sites. This results in an increasing slope of the curve as more O2 molecules are bound. As the number of O2 molecules bound to hemoglobin increases, the affinity of the remaining heme sites for O2 also increases. This is because the binding of O2 stabilizes the conformational change induced by the first O2 molecule, making it easier for additional O2 molecules to bind. This results in a steeper slope of the curve at intermediate O2 saturation levels.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B: (binding of one O2 molecule decreases the affinity of binding of other O2 molecules) is incorrect because it describes negative cooperativity, which results in a hyperbolic, not sigmoidal, O2 dissociation curve. Option C: (Bohr effect) and option D (Haldane effect) are both factors that influence the shape and position of the O2 dissociation curve, but they do not directly cause the sigmoid shape. The Bohr effect describes how the affinity of hemoglobin for O2 is influenced by pH and CO2 levels, while the Haldane effect describes how the binding of O2 to hemoglobin affects its ability to carry CO2 and vice versa.</p>\n<p><strong>Extraedge:</strong></p><p>Oxygen-hemoglobin dissociation curve The sigmoidal shape is characteristic of positive cooperativity binding of 1 O2 molecule to 1 subunit of deoxyhemoglobin increases affinity for O2 in adjacent subunits P50 is PO2 at which hemoglobin is 50% saturated ↑ P50 → ↓ hemoglobin affinity for O2 50% saturation achieved at higher-than-normal P50 ↓ P50 → ↑ hemoglobin affinity for O2 50% saturation achieved at lower-than-normal P50 Shift to the right mechanism ↑ P50 → ↓ hemoglobin affinity for O2 → ↑ O2 unloading causes ↑ PCO2, ↓ pH (Bohr Effect) ↑ PCO2 → ↑ H+ → ↓ pH CO2 + H2O → H2CO3 → H+ + HCO3- ↑ PCO2 → equilibrium reaction shifts right Le Chatelier's principle ↑ CO2, ↑ H+ bind hemoglobin and stabilize low O2 affinity T (taut) state ↓ hemoglobin affinity for O2 → ↑ O2 unloading g., exercise → ↑ PCO2, ↓ pH ↑ O2 unloading ensures O2 delivery meets O2 demand in skeletal muscle ↑ temperature g., ↑ tissue metabolism → ↑ temperature ↑ 2,3-bisphosphoglycerate (2,3-BPG) high altitude → hypoxemia → ↑ synthesis of 2,3-BPG Also seen in heart failure, anemia, morbid obesity, etc. ↑ 2,3-BPG binds hemoglobin and stabilizes low O2 affinity T (taut) state ↓ hemoglobin affinity for O2 → ↑ O2 unloading Shift to the left mechanism ↓ P50→ ↑ hemoglobin affinity for O2 → ↓ O2 unloading causes ↓ PCO2, ↑ pH (Bohr Effect) ↓ PCO2 → ↓ H+ → ↑ pH ↓ CO2, ↓ H+ → stabilizes high O2 affinity R (relaxed) state ↑ hemoglobin affinity for O2 → ↑ O2 loading conversely, ↑ O2 decreases Hb affinity for CO2/H (Haldane effect) ↓ temperature ↓ tissue metabolism → ↓ temperature ↓ 2,3-bisphosphoglycerate (2,3-BPG) hemoglobin F fetal hemoglobin 2 α subunits and 2 γ subunits (α2γ2) ↑ affinity for O2, ↓ affinity for 2,3-BPG facilitates O2 delivery from mother to fetus.</p>\n<p><strong>Table:</strong></p><p>Oxyhemoglobin\ndissociation curve Shifts in\noxyhemoglobin dissociation curve (ODC) reflect local tissue oxygen needs. Can\nbe helpful (meets metabolic needs) or harmful (in toxicities, pathophysiologic\nsituations). Right shift\nin ODC reflects Hb affinity for O, ↑ O, unloading at tissue. Physiologically\noccurs with ↑ O, needs: exercise, + pH, ↑ temperature/fever, hypoxia (†\n2,3-BPG); at the cellular level, caused by ↑ H+ and ↑ CO₂ created by tissue\nmetabolism (Bohr effect). Left shift in ODC reflects ↑ Hb affinity for O,→↓O,\nunloading at tissue. Physiologically occurs with O, needs (↓ temperature) and\npregnancy (fetal Hb has higher O, affinity than adult Hb, and ↑ O, binding due\nto affinity for 2,3-BPG → left shift, driving O, across placenta to fetus).\nPathologically occurs with ↑ CO, ↑ MetHb, genetic mutation (+2,3- BPG). Left is\nlower ODC has\nsigmoidal shape due to positive cooperativity (ie, tetrameric Hb molecule can\nbind 40, molecules and has higher affinity for each subsequent O, molecule\nbound). Myoglobin is monomeric and thus does not show positive cooperativity;\ncurve lacks sigmoidal appearance.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 67-year-old male is brought in by EMS after being found unconscious on the first floor of a burning building. On exam, his respiratory rate is 14 breaths/min with scattered wheezes. He has no evidence of any burns, but dark soot is caked around much of his face (see Figure ). Suspecting inhalational injury, you expect this man's oxygen-hemoglobin curve will be:", "options": [{"label": "A", "text": "Unchanged, because carbon monoxide (CO) is largely unbound and dissolved in plasma", "correct": false}, {"label": "B", "text": "Shifted right, due to strong competition between CO and O2 for binding", "correct": false}, {"label": "C", "text": "Shifted left, due to carbon monoxide binding", "correct": true}, {"label": "D", "text": "Shifted left, due to metabolic acidosis in tissues", "correct": false}], "correct_answer": "C. Shifted left, due to carbon monoxide binding", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683534544786-QTDY053010IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Shifted left, due to carbon monoxide binding The patient's clinical presentation is consistent with carbon monoxide (CO) poisoning, which causes the oxygen hemoglobin curve to shift to the left, due to tighter heme-O2 binding.</p>\n<p><strong>Highyeild:</strong></p><p>CO poisoning may be caused by inhaled smoke, motor vehicle fumes, or furnace emissions. CO has 200-250x greater affinity for hemoglobin than oxygen, so the vast majority of heme in the blood quickly becomes bound by CO. Importantly, CO binding to heme increases the heme affinity for oxygen at the other three oxygen binding sites. This leads to decreased oxygen unloading at the tissue level, resulting in tissue hypoxia. Because a given oxyhemoglobin concentration/saturation can therefore be reached at a lower partial pressure of oxygen, the oxygen-hemoglobin curve is shifted to the left.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A : Carbon monoxide predominantly binds hemoglobin , and less than 1% of the absorbed gas is found in the Solution Option B : Though CO and O2 compete for heme binding, the curve is shifted to the left because of the increased affinity of hemoglobin for oxygen at sites not bound to CO. Option D : Metabolic acidosis causes the dissociation curve to shift right, not left.</p>\n<p><strong>Extraedge:</strong></p><p>Oxygen-hemoglobin dissociation curve The sigmoidal shape is characteristic of positive cooperativity binding of 1 O2 molecule to 1 subunit of deoxyhemoglobin increases affinity for O2 in adjacent subunits P50 is PO2 at which hemoglobin is 50% saturated ↑ P50 → ↓ hemoglobin affinity for O2 50% saturation achieved at higher-than-normal P50 ↓ P50 → ↑ hemoglobin affinity for O2 50% saturation achieved at lower-than-normal P50 Shift to the right mechanism ↑ P50 → ↓ hemoglobin affinity for O2 → ↑ O2 unloading causes ↑ PCO2, ↓ pH (Bohr Effect) ↑ PCO2 → ↑ H+ → ↓ pH CO2 + H2O → H2CO3 → H+ + HCO3- ↑ PCO2 → equilibrium reaction shifts right Le Chatelier's principle ↑ CO2, ↑ H+ bind hemoglobin and stabilize low O2 affinity T (taut) state ↓ hemoglobin affinity for O2 → ↑ O2 unloading g., exercise → ↑ PCO2, ↓ pH ↑ O2 unloading ensures O2 delivery meets O2 demand in skeletal muscle ↑ temperature g., ↑ tissue metabolism → ↑ temperature ↑ 2,3-bisphosphoglycerate (2,3-BPG) high altitude → hypoxemia → ↑ synthesis of 2,3-BPG Also seen in heart failure, anemia, morbid obesity, etc. ↑ 2,3-BPG binds hemoglobin and stabilizes low O2 affinity T (taut) state ↓ hemoglobin affinity for O2 → ↑ O2 unloading Shift to the left mechanism ↓ P50→ ↑ hemoglobin affinity for O2 → ↓ O2 unloading causes ↓ PCO2, ↑ pH (Bohr Effect) ↓ PCO2 → ↓ H+ → ↑ pH ↓ CO2, ↓ H+ → stabilizes high O2 affinity R (relaxed) state ↑ hemoglobin affinity for O2 → ↑ O2 loading conversely, ↑ O2 decreases Hb affinity for CO2/H (Haldane effect) ↓ temperature ↓ tissue metabolism → ↓ temperature ↓ 2,3-bisphosphoglycerate (2,3-BPG) hemoglobin F fetal hemoglobin 2 α subunits and 2 γ subunits (α2γ2) ↑ affinity for O2, ↓ affinity for 2,3-BPG facilitates O2 delivery from mother to fetus.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Decreased O2 affinity of Hb in blood with decreased pH:", "options": [{"label": "A", "text": "Haldane effect", "correct": false}, {"label": "B", "text": "Double Haldane effect", "correct": false}, {"label": "C", "text": "Bohr effect", "correct": true}, {"label": "D", "text": "Double Bohr effect", "correct": false}], "correct_answer": "C. Bohr effect", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Bohr effect The correct answer is option C: Bohr effect. The Bohr effect describes how changes in pH affect the affinity of hemoglobin for oxygen. Specifically, as the pH decreases (i.e. becomes more acidic), the affinity of hemoglobin for oxygen decreases. This means that oxygen is more likely to be released from hemoglobin at lower pH levels , such as in the tissues where pH is lower due to increased carbon dioxide production and subsequent formation of carbonic acid.</p>\n<p><strong>Highyeild:</strong></p><p>The Bohr effect occurs because hydrogen ions (H+) can bind to certain amino acid residues in the hemoglobin molecule, causing a conformational change that decreases the affinity of hemoglobin for oxygen. This effect is particularly important in facilitating oxygen delivery to metabolizing tissues, where the production of carbon dioxide lowers pH and enhances oxygen unloading from hemoglobin.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A: (Haldane effect) describes how the binding of oxygen to hemoglobin affects its ability to bind to carbon dioxide , while option B (Double Haldane effect) is not a recognized term. Option D: (Double Bohr effect) is also not a recognized term, as the Bohr effect only describes the effect of pH on hemoglobin-oxygen binding and does not have a \"double\" version.</p>\n<p><strong>Extraedge:</strong></p><p>' The solubility of CO2 in blood is about 20 times that of O2; therefore, considerably more CO2 than O2 is present in a simple solution at equal partial pressures. The CO2 that diffuses into red blood cells is rapidly hydrated to H2CO3 because of the presence of carbonic anhydrase. The H2CO3 dissociates to H+ and HCO3-, and the H+ is buffered, primarily by hemoglobin, while the HCO3- enters the plasma.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 21 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "ADH exerts its effects on the collecting ducts of the kidney. Which of the following best characterizes ADH activity, as depicted in the Image?", "options": [{"label": "A", "text": "Binds and blocks A", "correct": false}, {"label": "B", "text": "Binds and blocks C", "correct": false}, {"label": "C", "text": "Binds at F and activates GI-mediated cyclic adenosine monophosphate cascade", "correct": false}, {"label": "D", "text": "Binds at F and activates Gs-mediated cyclic adenosine monophosphate cascade", "correct": true}], "correct_answer": "D. Binds at F and activates Gs-mediated cyclic adenosine monophosphate cascade", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Binds at F and activates Gs-mediated cyclic adenosine monophosphate cascade ADH binds V2 receptors on the basolateral side of the principal cell and activates a Gs-mediated cyclic adenosine monophosphate cascade. The final result is that aquaporin transmembrane channels, previously sequestered within intracellular vesicles, are mobilized to the luminal surface of the cells.</p>\n<p><strong>Highyeild:</strong></p><p>ADH hormone triggers chemical reactions that ultimately insert aquaporin-2 water channels into the membrane of collecting duct cells.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Net water movement may now occur from the collecting duct lumen to the hyperosmolar interstitium, decreasing urine output and conserving volume. Answer A is incorrect. A represents the apical sodium channel, which reabsorbs sodium from the collecting duct lumen. Option B. The potassium-sparing diuretics amiloride and triamterene bind and block this channel. Answer b is incorrect. Option C. C represents luminal aquaporins. While ADH indirectly mobilizes these proteins, it does not bind them directly. Option C is incorrect. ADH is coupled to GS, not GI.</p>\n<p><strong>Extraedge:</strong></p><p>Mechanism of action for vasopressin and V2-receptor antagonists. The binding of arginine vasopressin to the vasopressin V2 receptor (V2R) stimulates a G s-coupled protein that activates adenylyl cyclase, in turn causing the production of cyclic adenosine monophosphate to activate protein kinase A.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "In response to an increase in GFR, the proximal tubule and the loop of Henle demonstrate an increase in the rate of Na+ reabsorption. This phenomenon is called ___", "options": [{"label": "A", "text": "Autoregulation", "correct": false}, {"label": "B", "text": "Glomerulo tubular balance", "correct": true}, {"label": "C", "text": "Mineralocorticoid escape", "correct": false}, {"label": "D", "text": "Saturation of tubular transport", "correct": false}], "correct_answer": "B. Glomerulo tubular balance", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Glomerulo tubular balance One of the most basic mechanisms for controlling tubular reabsorption is the intrinsic ability of the tubules to increase their reabsorption rate in response to increased tubular load (increased tubular inflow). This phenomenon is referred to as glomerulotubular Thus, glomerulotubular balance refers to the fact that the total rate of reabsorption increases as the filtered load increases, even though the percentage of GFR reabsorbed in the proximal tubule remains relatively constant at about 65 percent .</p>\n<p><strong>Highyeild:</strong></p><p>Glomerulotubular balance refers to the ability of the proximal tubule and the loop of Henle to adjust their reabsorption rates in response to changes in the glomerular filtration rate (GFR). When GFR increases, the rate of Na+ delivery to the proximal tubule also increases. To maintain a balance between the filtered load and the rate of reabsorption, the proximal tubule increases its rate of Na+ reabsorption. Similarly, the loop of Henle also responds to an increase in GFR by increasing its rate of Na+ reabsorption. This adaptive mechanism helps to maintain a stable Na+ balance in the body despite variations in GFR.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Autoregulation by GFR refers to the ability of the kidneys to maintain a relatively constant GFR despite changes in blood pressure. Option C. Mineralocorticoid escape refers to the phenomenon where the body can partially or completely escape the effects of aldosterone, a hormone that regulates salt and water balance in the body. Option D. Saturation of tubular transport refers to the point at which the maximum rate of transport across a membrane has been reached.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The glomerulus is a unique vascular structure consisting of a capillary bed interposed between two arterioles: the afferent and efferent arterioles. Image shows features such as, Select the incorrect:-", "options": [{"label": "A", "text": "Supported by the mesangium", "correct": false}, {"label": "B", "text": "Composed of intraglomerular mesangial cells", "correct": false}, {"label": "C", "text": "The main site for ultrafiltration", "correct": false}, {"label": "D", "text": "Receives blood supply from an efferent arteriole", "correct": true}], "correct_answer": "D. Receives blood supply from an efferent arteriole", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683534394893-QTDY049003IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Receives blood supply from an efferent arteriole Receives blood supply from an afferent arteriole. The given Images shows Glomerulus (red), Bowman's capsule (blue), and proximal tubule (green).</p>\n<p><strong>Highyeild:</strong></p><p>The glomerulus is a network of small blood vessels (capillaries) known as a tuft, located at the beginning of a nephron in the kidney. Each of the two kidneys contains about one million nephrons. The tuft is structurally supported by the mesangium (the space between the blood vessels), composed of intraglomerular mesangial cells. The blood is filtered across the capillary walls of this tuft through the glomerular filtration barrier, which yields its filtrate of water and soluble substances to a cup-like sac known as Bowman's capsule. The filtrate then enters the renal tubule of the nephron. The glomerulus receives its blood supply from an afferent arteriole of the renal arterial circulation. Unlike most capillary beds, the glomerular capillaries exit into efferent arterioles rather than venules. The resistance of the efferent arterioles causes sufficient hydrostatic pressure within the glomerulus to provide the force for ultrafiltration.</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option A. It is supported by the mesangium Option B. It is composed of intraglomerular mesangial cells Option C. It is the main site for ultrafiltration</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The glomerular capillary membrane has a structure similar to membranes of other capillaries in the body including capillaries in the brain. Select the correct difference between the glomerular capillary membrane and other capillary membranes?", "options": [{"label": "A", "text": "The glomerular capillary membrane has three layers instead of two layers", "correct": false}, {"label": "B", "text": "Endothelium of the capillary; basement membrane; the layer of epithelial cells (podocytes)", "correct": false}, {"label": "C", "text": "Endothelium of the capillary; the layer of epithelial cells (podocytes)", "correct": false}, {"label": "D", "text": "Only C correct", "correct": true}], "correct_answer": "D. Only C correct", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Only C correct The glomerular capillary membrane is similar to that of other capillaries, except that it has three (instead of the usual two) major layers: (1) the endothelium of the capillary; (2) a basement membrane; and (3) a layer of epithelial cells (podocytes) surrounding the outer surface of the capillary basement membrane.</p>\n<p><strong>Highyeild:</strong></p><p>The glomerular basement membrane of the kidney is the basal lamina layer of the glomerulus. The glomerular endothelial cells, the glomerular basement membrane, and the filtration slits between the podocytes perform the filtration function of the glomerulus, separating the blood in the capillaries from the filtrate that forms in Bowman's capsule.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Glomerular capillary membrane has three layers instead of two layers Option B. There are Endothelium of the capillary; basement membrane; the layer of epithelial cells (podocytes)</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The glomerular basement membrane of the kidney is the basal lamina layer of the glomerulus. The glomerular endothelial cells, the glomerular basement membrane, and the filtration slits between the podocytes perform the filtration function of the glomerulus, separating the blood in the capillaries from the filtrate that forms in Bowman's capsule. Select the correct:", "options": [{"label": "A", "text": "BM contains heparan sulfate adjacent to podocytes", "correct": false}, {"label": "B", "text": "BM contains chondroitin sulfate adjacent to endothelial cells", "correct": false}, {"label": "C", "text": "Impaired glomerular filtration membrane function is nephrotic syndrome", "correct": false}, {"label": "D", "text": "All correct", "correct": true}], "correct_answer": "D. All correct", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>All correct Options A, B, and C are correct The glomerular basement membrane of the kidney is the basal lamina layer of the glomerulus. The glomerular endothelial cells, the glomerular basement membrane, and the filtration slits between the podocytes perform the filtration function of the glomerulus, separating the blood in the capillaries from the filtrate that forms in Bowman's capsule.</p>\n<p><strong>Highyeild:</strong></p><p>The glomerular basement membrane is a fusion of the endothelial cell and podocyte basal laminas and is the main site of restriction of water flow. The glomerular basement membrane is secreted and maintained by podocyte cells.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. - BM contains heparan sulfate adjacent to podocytes Option B. - BM contains chondroitin sulfate adjacent to endothelial cells Option C.- Impaired glomerular filtration membrane function is nephrotic syndrome</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Podocytes are cells in Bowman's capsule in the kidneys that surround the capillaries of the glomerulus. Podocytes make up the epithelial lining of Bowman's capsule, Select the incorrect:", "options": [{"label": "A", "text": "Essential component of the filtration membrane", "correct": false}, {"label": "B", "text": "Long foot process, pedicles", "correct": false}, {"label": "C", "text": "Nephrin protein is helpful in ultrafiltration with podocytes", "correct": false}, {"label": "D", "text": "Incorrect C", "correct": true}], "correct_answer": "D. Incorrect C", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Incorrect C Options A, B, and C are correct Podocytes are cells in Bowman's capsule in the kidneys that wrap around the capillaries of the glomerulus. Podocytes make up the epithelial lining of Bowman's capsule, the third layer through which filtration of blood takes place.</p>\n<p><strong>Highyeild:</strong></p><p>Bowman's capsule filters the blood, retaining large molecules such as proteins while smaller molecules such as water, salts, and sugars are filtered as the first step in the formation of urine. The pedicels wrap around the capillaries and leave slits between them. Blood is filtered through these slits, each known as a filtration slit, slit diaphragm, or slit pore. Several proteins are required for the pedicels to wrap around the capillaries and function. When infants are born with certain defects in these proteins, such as nephrin and CD2AP, their kidneys cannot function.</p>\n<p><strong>Extraedge:</strong></p><p>Histological slides of Kidney Cortex:- Glomerulus, urinary pole, vascular pole with macula densa, proximal convoluted tubule. The renal corpuscle is where plasma is filtered from capillaries into the renal tubules. At the center of the renal corpuscle is the glomerulus, a meshwork of capillaries. Bowman's capsule surrounds the glomerulus. The space in between Bowman's capsule and the glomerulus is called Bowman's space and is where the ultrafiltrate of plasma is first collected.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The glomerular filtration membrane contains specific apertures for the movement of selective solutes across the filtration membrane as shown in the image. Select the incorrect:-", "options": [{"label": "A", "text": "Fenestrations are round or ovoid transcellular holes in the endothelium in organs with a high rate of exchange.", "correct": false}, {"label": "B", "text": "Fenestrations are round or ovoid transcellular holes in the visceral layer of the Bowman capsule", "correct": true}, {"label": "C", "text": "Slit pores are spaces between the pedicles on the glomerular basement membrane", "correct": false}, {"label": "D", "text": "Water, glucose, amino acids, and other chemicals pass as they become renal filtrate.", "correct": false}], "correct_answer": "B. Fenestrations are round or ovoid transcellular holes in the visceral layer of the Bowman capsule", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683534394950-QTDY049007IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Fenestrations are round or ovoid transcellular holes in the visceral layer of the Bowman capsule Fenestrations are round or ovoid transcellular holes in the endothelium in organs with a high rate of exchange occur as in glomerulus in nephrons.</p>\n<p><strong>Highyeild:</strong></p><p>Glomerular endothelial cell (GEnC) fenestrations are analogous to podocyte filtration slits, but their important contribution to the glomerular filtration barrier has not received corresponding attention. GEnC fenestrations are trans cytoplasmic holes, specialized for their unique role as a prerequisite for filtration across the glomerular capillary wall.</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option A. Fenestrations are round or ovoid transcellular holes in the endothelium in organs with a high rate of exchange. Option C. Slit pores are spaces between the pedicles on the glomerular basement membrane . Option D. Water, glucose, amino acids, and other chemicals pass via slit pores as renal filtrate.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Endothelial cells line the capillaries in Bowman's capsule. Capillaries form the glomerulus. Physiologists determined the presence of a specific gap between two endothelial cells in capillaries. Select the correct:", "options": [{"label": "A", "text": "70-80 nm", "correct": false}, {"label": "B", "text": "70-90 nm", "correct": true}, {"label": "C", "text": "60-90 nm", "correct": false}, {"label": "D", "text": "60-70 nm", "correct": false}], "correct_answer": "B. 70-90 nm", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>70-90 nm The specific gap between two endothelial cells in capillaries is 70-90 nm.</p>\n<p><strong>Highyeild:</strong></p><p>The glomerular capillaries are lined by a fenestrated endothelium that sits on the glomerular basement membrane, which in turn is covered by glomerular epithelium, or podocytes, which envelop the capillaries with cellular extensions called foot processes. In between the foot processes are the filtration slits. These three structures- the fenestrated endothelium, glomerular basement membrane, and glomerular epithelium are the glomerular filtration barrier.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. 70-80 nm incorrect Option C. 60-90 nm incorrect Option D. 60-70 nm incorrect</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A child of age 7 years was taken to the hospital with presentations of edema of the face, and legs, and proteinuria. The physician recommended prednisolone therapy for one month initially but found that manifestations were nonresponsive to the steroid treatment. Later on, a Kidney biopsy reported the presence of focal segmental glomerulosclerosis. Select the incorrect?", "options": [{"label": "A", "text": "Podocin is deficient in podocytes", "correct": false}, {"label": "B", "text": "Mutation NPHS2 gene", "correct": false}, {"label": "C", "text": "Mutation NPHS1 gene", "correct": true}, {"label": "D", "text": "Impaired ultrafiltration leading to proteinuria", "correct": false}], "correct_answer": "C. Mutation NPHS1 gene", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683534394978-QTDY049009IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Mutation NPHS1 gene The mutation NPHS2 gene causes a deficiency of podocin. Kidney biopsy shows a light micrograph of focal segmental glomerulosclerosis, hilar variants, and PAS stain.</p>\n<p><strong>Highyeild:</strong></p><p>Podocin is a protein component of the filtration slits of podocytes. Glomerular capillary endothelial cells, the glomerular basement membrane, and the filtration slits function as the filtration barrier of the kidney glomerulus. Mutations in the podocin gene NPHS2 can cause nephrotic syndromes, such as focal segmental glomerulosclerosis (FSGS) or minimal change disease (MCD). Symptoms may develop in the first few months of life (congenital nephrotic syndrome) or later in childhood</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option A. Podocin is deficient in podocytes in nephrotic syndrome Option B. Mutation NPHS2 gene Option D. Impaired ultrafiltration leads to proteinuria in the deficiency of podocin</p>\n<p><strong>Extraedge:</strong></p><p>Focal segmental glomerulosclerosis (FSGS) is a histopathologic finding of scarring (sclerosis) of glomeruli and damage to renal podocytes. This process damages the filtration function of the kidney, resulting in protein loss in the urine. FSGS is a leading cause of excess protein loss, nephrotic syndrome in children and adults.</p>\n<p><strong>Table:</strong></p><p>Nephrotic syndrome Nephrotic syndrome-massive proteinuria (> 3.5 g/day) Minimal change disease Also called lipoid nephrosis. Most common cause of nephrotic syndrome\n in children. Minimal change disease Often 1° (idiopathic) and may be triggered by recent infection,\n immunization, immune stimulus (4 I's of MCD). Rarely, may be 2° to lymphoma\n (eg, cytokine-mediated damage). 1° disease has excellent response to glucocorticoids. - LM-Normal\n glomeruli (lipid may be seen in PT cells) . IF-O EM-effacement of podocyte foot processes A Focal segmental glomerulosclerosis Higher prevalence in Black people. Can be 1° (idiopathic) or 2° to other conditions (eg, HIV infection,\n sickle cell disease, heroin use, obesity, interferon treatment, or congenital\n malformations). 1° disease has inconsistent response to steroids. May progress to CKD.\n LM-segmental sclerosis and hyalinosis B IF-often but may be for nonspecific focal deposits of IgM, C3, Cl\n EM-effacement of foot processes similar to minimal change disease Membranous nephropathy Can be 1° (eg, antibodies to phospholipase A, receptor) or 2° to drugs\n (eg, NSAIDs, penicillamine, gold), infections (eg, HBV, HCV, syphilis), SLE,\n or solid tumors. ↑ risk for thromboembolism (eg, DVT, renal vein thrombosis). 1° disease has poor response to steroids. May progress to CKD.\n LM-diffuse capillary and GBM thickening C IF-granular due to immune complex (IC) deposition EM-“Spike and\n dome\" appearance of subepithelial deposits Amyloidosis Kidney is the most commonly involved organ (systemic amyloidosis).\n Associated with chronic conditions that predispose to amyloid deposition (eg,\n AL amyloid, AA amyloid, prolonged dialysis). – LM-Congo red stain shows\n apple-green birefringence under polarized light due to amyloid deposition in\n the mesangium Diabetic glomerulo- nephropathy Most common cause of ESRD in the United States. Hyperglycemia → nonenzymatic glycation of tissue proteins → mesangial\n expansion; GBM thickening and ↑ permeability. Hyperfiltration (glomerular HTN\n and ↑ GFR) → glomerular hypertrophy and glomerular scarring\n (glomerulosclerosis) → further progression of nephropathy. – LM-Mesangial\n expansion, GBM thickening, eosinophilic nodular glomerulosclerosis\n (Kimmelstiel-Wilson lesions D</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The visceral epithelium in Bowman's capsule is the inner layer of cells. Its cells are highly specialized and called podocytes. These have foot processes called pedicels. Select the incorrect?", "options": [{"label": "A", "text": "Pedicels interdigitate to form slits", "correct": false}, {"label": "B", "text": "Slits are covered by slit diaphragms", "correct": false}, {"label": "C", "text": "Slits are 35 nm wide", "correct": true}, {"label": "D", "text": "Slits are 25 nm wide", "correct": false}], "correct_answer": "C. Slits are 35 nm wide", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Slits are 35 nm wide Normal width is 25 nm in slits Each podocyte has many foot processes, which interdigitate to form filtration slits. The slits are approximately 25 nm wide and each is closed by an extremely thin process called slit diaphragms which bridge the slits between the pedicels.</p>\n<p><strong>Highyeild:</strong></p><p>Slit diaphragms are widened versions of the tight junctions and adherens junctions. The foot processes known as pedicels that extend from the podocytes wrap themselves around the capillaries of the glomerulus to form the filtration slits.</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option A. Pedicels interdigitate to form slits in thevisceral epithelium. Option B. Slits are covered by slit diaphragms. Option D. Slits are 25 nm wide.</p>\n<p><strong>Extraedge:</strong></p><p>The pedicels increase the surface area of the cells enabling efficient ultrafiltration. Podocytes secrete and maintain the basement membrane.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The glomerular filtration membrane undertakes a function of ultrafiltration to form glomerular filtrate in the space of Bowman's capsule. Physiologists reported selective permeability of the Glomerular filtration membrane. Select the incorrect?", "options": [{"label": "A", "text": "Neutral substances which are < 4 nm are freely filtered", "correct": false}, {"label": "B", "text": "Neutral substances which are > 8 nm are not filtered", "correct": false}, {"label": "C", "text": "Neutral substances between 4 to 8 nm are freely filtered", "correct": true}, {"label": "D", "text": "Neutral substances between Between 4 nm and 8 nm have permeability inversely proportional to the diameter.", "correct": false}], "correct_answer": "C. Neutral substances between 4 to 8 nm are freely filtered", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Neutral substances between 4 to 8 nm are freely filtered Neutral substances between 4 to 8 nm are not freely filtered. Their permeability is inversely proportional to the diameter.</p>\n<p><strong>Highyeild:</strong></p><p>The glomerular filtration barrier (GFB) is characterized by a very high hydraulic permeability, combined with a marked permselectivity that excludes macromolecules such as albumin. Thus, the GFB retains most of the plasma proteins, with only 0.06% of albumin getting across the basement membrane.</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option A. Neutral substances which are < 4 nm are freely filtered. Option B. Neutral substances which are > 8 nm are not filtered. Option D. Neutral substances between 4 nm and 8 nm have permeability inversely proportional to the diameter.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Glomerular filtration membrane is effective in ultrafiltration. Physiologists observed that filtration of negatively charged molecules is comparatively more difficult than that of positively charged molecules.Select the correct?", "options": [{"label": "A", "text": "Presence of Sialoproteins on the filtering membrane", "correct": true}, {"label": "B", "text": "Larger negatively charged molecules", "correct": false}, {"label": "C", "text": "Positively charged proteins on the filtering membrane", "correct": false}, {"label": "D", "text": "Low pH of urine", "correct": false}], "correct_answer": "A. Presence of Sialoproteins on the filtering membrane", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Presence of Sialoproteins on the filtering membrane The presence of negatively charged sialoproteins on the filtering membrane is the correct statement. Sialoproteins in the glomerular capillary wall are negatively charged, and the negative charges repel negatively charged substances in the</p>\n<p><strong>Highyeild:</strong></p><p>The glomerular epithelial polyanion is a specialized cell surface component found on renal glomerular epithelial cells (podocytes) that is rich in sialoprotein(s), as detected by staining with cationic dyes The glomerular capillary wall or filtration barrier consists of three components: the capillary endothelium, basement membrane, and visceral epithelium.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. Larger negatively charged molecules is an incorrect option Option C. Positively charged proteins on filtering membranes is an incorrect option. Under normal conditions, high molecular weight proteins in the plasma (e.g., albumin and globulin) cannot pass through the filtration membrane due to the effects of the size barrier and charge barrier of the glomerular capillary filtration membrane. Option D. Low pH of urine is an incorrect option</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Adolescent in age 15 years was taken to a nephrologist for manifestations of lethargy, nausea, loss of appetite, and passing red-colored urine past 3 months. Examination and tests revealed the presence of Alport syndrome. Select the correct option?", "options": [{"label": "A", "text": "Deficiency of Collagen IV in basal lamina in Bowman capsule", "correct": false}, {"label": "B", "text": "Impaired glomerular filtration membrane function", "correct": false}, {"label": "C", "text": "Rare cases with aortic dissection", "correct": false}, {"label": "D", "text": "All of the above", "correct": true}], "correct_answer": "D. All of the above", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>All of the above In the case of the 15-year-old adolescent, lethargy, nausea, loss of appetite, and passing red-colored urine are likely symptoms of kidney damage and dysfunction. The diagnosis of Alport syndrome was confirmed through genetic testing or a kidney biopsy, which showed characteristic changes in the basement membranes of the kidneys.</p>\n<p><strong>Highyeild:</strong></p><p>Alport syndrome is a genetic disorder that affects the kidneys, ears, and eyes. It is caused by mutations in genes that encode for type IV collagen, a protein that is an essential component of basement membranes in the kidneys, ears, and eyes. Alport syndrome is characterized by progressive kidney damage that can lead to chronic kidney disease and end-stage renal disease.</p>\n<p><strong>Random:</strong></p><p>Explanation for other Options:- Option A. Alport syndrome is featured with a deficiency of Collagen IV in basal lamina in the Bowman capsule. Option B. Collagen IV deficiency leads to altered structure and function of glomerular filtration membrane function Option C. Rare cases of Alport syndrome associated with aortic dissection</p>\n<p><strong>Table:</strong></p><p>Nephritic syndrome Nephritic syndrome = inflammatory process. Infection-associated glomerulonephritis Formerly called post-infectious glomerulonephritis. Type III hypersensitivity reaction. Associated with hypocomplementemia\n (due to consumption). Children: most commonly caused by group A streptococcus\n (poststreptococcal glomerulonephritis). Seen ~2-4 weeks after pharyngeal or\n skin infection. strep serologies. Usually resolves spontaneously. Adults: in addition to group A streptococcus, can also be caused by\n staphylococcus. Seen during infection; infection site is variable but usually\n not upper respiratory tract. Must be identified on culture as no serologic\n test available. May progress to renal insufficiency. LM-glomeruli enlarged and hypercellular A IF-granular (\"starry\n sky\") appearance (\"lumpy-bumpy”) B due to IgG, IgM, and C3\n deposition along GBM and mesangium EM-subepithelial IC humps IgA nephropathy (Berger disease Poor prognosis, rapidly deteriorating renal function (days to weeks).\n LM-crescent moon shape C. Crescents consist of fibrin and plasma proteins\n (eg, C3b) with Rapidly progressive (crescentic) glomerulonephritis glomerular parietal cells, monocytes, macrophages Several disease processes may result in this pattern which may be\n delineated with IF. Linear IF due to antibodies to GBM and alveolar basement membrane:\n Goodpasture syndrome hematuria/hemoptysis; type II hypersensitivity reaction.\n Treatment: plasmapheresis Negative IF/Pauci-immune (no IgC3 deposition): granulomatosis with\n polyangiitis- PR3-ANCA/c-ANCA, eosinophilic granulomatosis with polyangiitis or\n Microscopic polyangiitis-MPO-ANCA/P-ANCA Granular IF-PSGN or DPGN Diffuse proliferative glomerulonephritis Often due to SLE (think \"wire lupus\"). DPGN and MPGN often\n present as nephrotic syndrome and nephritic syndrome concurrently. LM-\"wire looping\" of\n capillaries D IF-granular; EM-subendothelial, sometimes subepithelial or\n intramembranous IgG-based ICs often with C3 deposition Alport syndrome Mutation in type IV collagen irregular thinning and thickening and\n splitting of glomerular basement membrane. Most commonly X-linked dominant. Eye problems (eg, retinopathy,\n anterior lenticonus), glomerulonephritis, sensorineural deafness; \"can't\n see, can't pee, can't hear a bee.\" • EM-“basket-weave\" appearance due to irregular thickening of GBM Membrano- proliferative glomerulonephritis MPGN is a nephritic syndrome that often co-presents with nephrotic\n syndrome. Type I may be 2° to hepatitis B or C infection. May also be\n idiopathic. - Subendothelial IC deposits with granular IF Type II is associated with C3 nephritic factor (IgG autoantibody that\n stabilizes C3 convertase → persistent complement activation → C3 levels). • Intramembranous deposits, also called dense deposit disease Both types: mesangial ingrowth → GBM splitting → “tram-track” on\n H&E and PAS E stains.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Benign familial hematuria is an autosomal dominant condition. It manifests as nonprogressive isolated microscopic hematuria that does not result in renal failure. Patient of age 23 years presented with the manifestations of Benign familial hematuria past several months as reported by relatives in history. Select the correct?", "options": [{"label": "A", "text": "Mutation in COL4A3 or COL4A4 gene", "correct": false}, {"label": "B", "text": "Basement membrane nephropathy", "correct": false}, {"label": "C", "text": "Patients remain asymptomatic in most cases", "correct": false}, {"label": "D", "text": "Only Incorrect B", "correct": true}], "correct_answer": "D. Only Incorrect B", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Only Incorrect B This condition results in basement membrane nephropathy. In the case of the 23-year-old patient, the presence of benign familial hematuria is suggested by the reported history of isolated microscopic hematuria over several months. Diagnosis of the condition is typically made by ruling out other causes of hematuria, such as infections, kidney stones, or malignancies.</p>\n<p><strong>Highyeild:</strong></p><p>Thin basement membrane nephropathy is considered a relatively common disorder. In most patients, the only abnormal finding on kidney biopsy is diffuse thinning of the glomerular basement membranes (GBM) requiring electron microscopy for the diagnosis Historically, these patients were often described as having benign familial hematuria.</p>\n<p><strong>Random:</strong></p><p>Explanation for other Options:- Option A. Mutation in COL4A3 or COL4A4 gene is responsible for manifestations of Benign familial hematuria which is autosomal but has a dominant pattern of inheritance Option B. Condition is associated with basement membrane nephropathy Option C. Microscopic hematuria may be detected along with mild transitory proteinuria on examination of patients with febrile conditions and clinical manifestations related to the urinary system. Microscopic hematuria might also be found randomly, during routine urine examinations in asymptomatic persons or during preventive procedures</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A male patient of 58 years reported lethargy, frothy urine, weakness, and passing-blood coloured urine past 2 months. Examination and tests confirmed the case of Fibrillary glomerulonephritis. Select the incorrect?", "options": [{"label": "A", "text": "Fibrillary deposits in the BM of glomeruli", "correct": false}, {"label": "B", "text": "Fibrils are made of amyloid proteins", "correct": true}, {"label": "C", "text": "Fibrils are made from immunoglobulins", "correct": false}, {"label": "D", "text": "All incorrect", "correct": false}], "correct_answer": "B. Fibrils are made of amyloid proteins", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Fibrils are made of amyloid proteins In the case of the 58-year-old male patient, the lethargy, frothy urine, weakness, and passing blood-colored urine are likely related to the kidney dysfunction caused by fibrillary glomerulonephritis. The diagnosis was confirmed through examination and tests, such as a kidney biopsy, which showed the characteristic deposits of fibrils in the glomeruli.</p>\n<p><strong>Highyeild:</strong></p><p>Fibrillary glomerulonephritis and immunotactoid glomerulopathy, a similar but rarer condition, are two forms of non-amyloid fibrillary glomerular deposition diseases. Similar to amyloidosis, fibrils deposit in the wall of the glomerulus (in the basement membrane), but these fibrils are made from immunoglobulins rather than amyloid proteins. Under normal conditions, the glomerulus filters the blood to form urine and keeps the fibrils (which are important for cell structure).</p>\n<p><strong>Random:</strong></p><p>Explanation for other options:- Option A. Fibrillary deposits in the BM of glomeruli occur. Option B. Fibrils are not made of amyloid proteins. Option C. Fibrils are made from immunoglobulins , non-amyloid</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Patients at the age of 23 years presented with signs of the tetrad of changes in the nails, knees, and elbows, and the presence of iliac horns. The diagnosis was Nail-patella syndrome. Select the incorrect?", "options": [{"label": "A", "text": "Impaired glomerular basement membrane", "correct": false}, {"label": "B", "text": "Proteinuria with or without hematuria", "correct": false}, {"label": "C", "text": "Nails may be absent, hypoplastic", "correct": false}, {"label": "D", "text": "All incorrect", "correct": true}], "correct_answer": "D. All incorrect", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>All incorrect In the case of the 23-year-old patient, the presence of the tetrad of changes in the nails, knees, and elbows, as well as the iliac horns, is suggestive of nail-patella syndrome.</p>\n<p><strong>Highyeild:</strong></p><p>Nail-patella syndrome is a rare genetic disorder that affects multiple organs in the body, including the kidneys, eyes, and skeletal system. It is caused by mutations in the LMX1B gene, which is involved in the development of the limbs, kidneys, and eyes.</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option A. Impaired glomerular basement membrane in the condition leads to renal failure and end-stage kidney diseases. Option B. Proteinuria with or without hematuria is due to a changed glomerular basement structure. Option C. Nails may be absent, hypoplastic in the condition.</p>\n<p><strong>Extraedge:</strong></p><p>The classic features of nail-patella syndrome include abnormalities of the nails, knees, and elbows, as well as the presence of iliac horns, which are bony protrusions on the pelvis . The nail abnormalities can include absent or underdeveloped nails, ridges or splits in the nails, and other deformities.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The image below depicts types of cells that together constitute a specific tissue in the nephron. Select the name of the tissue from the list below?", "options": [{"label": "A", "text": "Glomerular filtration membrane", "correct": false}, {"label": "B", "text": "Juxtaglomerular apparatus", "correct": true}, {"label": "C", "text": "Renal capillary network", "correct": false}, {"label": "D", "text": "Ultrastructure of bowman’s capsule", "correct": false}], "correct_answer": "B. Juxtaglomerular apparatus", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683534395077-QTDY049017IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Juxtaglomerular apparatus The renin in kidney extracts and the bloodstream is produced by the juxtaglomerular cells (JG cells). These epithelioid cells are located in the media of the afferent arterioles as they enter the glomeruli.</p>\n<p><strong>Highyeild:</strong></p><p>The membrane-lined secretory granules in them have been shown to contain renin. Renin is also found in agranular lacis cells that are located in the junction between the afferent and efferent arterioles, but its significance in this location is unknown. At the point where the afferent arteriole enters the glomerulus and the efferent arteriole leaves it, the tubule of the nephron touches the arterioles of the glomerulus from which it arose. At this location, which marks the start of the distal convolution, there is a modified region of tubular epithelium called the macula densa . The macula densa is in close proximity to the JG cells. The lacis cells, the JG cells, and the macula densa constitute the juxtaglomerular apparatus.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A - The glomerular filtration barrier is composed of (1) pedicles of podocytes (visceral epithelium of Bowman's capsule), (2) glomerular basement membrane (GBM) or basal lamina (produced by both endothelial and epithelial cells), and (3) the fenestrated endothelium of glomerular capillaries Option B - Peritubular capillaries are tiny blood vessels in your kidneys . They filter waste from your blood so the waste can leave your body through urine. Peritubular capillaries also reabsorb nutrients your body needs to work properly, such as minerals. Option D - Bowman's capsule surrounds the glomerular capillary loops and participates in the filtration of blood from the glomerular capillaries. Bowman's capsule also has a structural function and creates a urinary space through which filtrate can enter the nephron and pass to the proximal convoluted tubule</p>\n<p><strong>Table:</strong></p><p>Juxtaglomerular apparatus Consists of mesangial cells, JG cells (modified smooth muscle of\n afferent arteriole), and the macula densa (NaCl sensor located at the DCT).\n JG cells secrete renin in response to ↓ renal blood pressure and ↑\n sympathetic tone (B). Macula densa cells sense + NaCl delivery to DCT trenin\n release → efferent arteriole vasoconstriction → ↑ GFR. JGA maintains GFR via renin-angiotensin- aldosterone system.\n B-blockers BP by CO and inhibiting B ₁ - receptors of the JGA → + renin release.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Kidneys possess a Tubuloglomerular feedback mechanism. It senses the rate of glomerular filtration to the concentration of sodium chloride in tubule fluid at the macula densa and autoregulation of GFR and renal blood flow. Select the best-suited components of the Tubuloglomerular feedback mechanism?", "options": [{"label": "A", "text": "Afferent arteriolar feedback component", "correct": false}, {"label": "B", "text": "Efferent arteriolar feedback component", "correct": false}, {"label": "C", "text": "Anatomical arrangements of the juxtaglomerular complex", "correct": false}, {"label": "D", "text": "All best-suited components", "correct": true}], "correct_answer": "D. All best-suited components", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>All best-suited components The kidneys have a special feedback mechanism that links changes in the sodium chloride concentration at the macula densa with the control of renal arteriolar resistance and autoregulation of GFR.</p>\n<p><strong>Highyeild:</strong></p><p>This feedback helps ensure relatively constant delivery of sodium chloride to the distal tubule and helps prevent spurious fluctuations in renal excretion that would otherwise occur. In many circumstances, this feedback autoregulation renal blood flow and GFR in parallel.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- The tubuloglomerular feedback mechanism has two components that act together to control GFR: (1) an afferent arteriolar feedback mechanism; and (2) an efferent arteriolar feedback mechanism. These feedback mechanisms depend on special anatomical arrangements of the juxtaglomerular complex.</p>\n<p><strong>Table:</strong></p><p>Juxtaglomerular apparatus Consists of mesangial cells, JG cells (modified smooth muscle of\n afferent arteriole), and the macula densa (NaCl sensor located at the DCT).\n JG cells secrete renin in response to ↓ renal blood pressure and ↑\n sympathetic tone (B). Macula densa cells sense + NaCl delivery to DCT trenin\n release → efferent arteriole vasoconstriction → ↑ GFR. JGA maintains GFR via renin-angiotensin- aldosterone system.\n B-blockers BP by CO and inhibiting B ₁ - receptors of the JGA → + renin release.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The image below describes the structure of the juxtaglomerular apparatus in kidneys. Select the correct type of cells for the A and B marked in the image in red color?", "options": [{"label": "A", "text": "Juxtaglomerular cells----A, macula densa----B", "correct": true}, {"label": "B", "text": "Juxtaglomerular cells----B, macula densa----A", "correct": false}, {"label": "C", "text": "Visceral epithelial cells----A, podocytes-----B", "correct": false}, {"label": "D", "text": "None", "correct": false}], "correct_answer": "A. Juxtaglomerular cells----A, macula densa----B", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/questionImage-1688450644431-QTDY049019IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Juxtaglomerular cells----A, macula densa----B The tubuloglomerular feedback mechanism has two components that act together to control GFR: (1) an afferent arteriolar feedback mechanism; and (2) an efferent arteriolar feedback mechanism. These feedback mechanisms depend on special anatomical arrangements of the juxtaglomerular complex .</p>\n<p><strong>Highyeild:</strong></p><p>The juxtaglomerular complex consists of macula densa cells in the initial portion of the distal tubule and juxtaglomerular cells in the walls of the afferent and efferent arterioles. The macula densa is a specialized group of epithelial cells in the distal tubules that comes in close contact with the afferent and efferent arterioles. The macula densa cells contain the Golgi apparatus, which consists of intracellular secretory organelles directed toward the arterioles, suggesting that these cells may be secreting a substance toward the arterioles.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. glomerular visceral epithelial cell is a specialized kidney epithelial cell that contains \"feet\" that interdigitate with the \"feet\" of other glomerular epithelial cells. Option B. Incorrect option- Juxtaglomerular cells----B, macula densa----A Option C. Incorrect option- Visceral epithelial cells----A, podocytes-----B</p>\n<p><strong>Table:</strong></p><p>Juxtaglomerular apparatus Consists of mesangial cells, JG cells (modified smooth muscle of\n afferent arteriole), and the macula densa (NaCl sensor located at the DCT).\n JG cells secrete renin in response to ↓ renal blood pressure and ↑\n sympathetic tone (B). Macula densa cells sense + NaCl delivery to DCT trenin\n release → efferent arteriole vasoconstriction → ↑ GFR. JGA maintains GFR via renin-angiotensin- aldosterone system.\n B-blockers BP by CO and inhibiting B ₁ - receptors of the JGA → + renin release.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The macula densa cells can control the renal blood flow in afferent arterioles and regulate the release of renin from juxtaglomerular cells in afferent and efferent arterioles. Select the best possible explanation of macula densa cell’s sensitivity to above-stated functions?", "options": [{"label": "A", "text": "Reduction in GFR → reduction in flow rate in loop of Henle → increased reabsorption of sodium chloride in ascending loop of Henle → reduces concentration of sodium chloride in macula densa", "correct": false}, {"label": "B", "text": "Decreases resistance to blood flow in the afferent arterioles →raises glomerular hydrostatic pressure → normalizes GFR", "correct": false}, {"label": "C", "text": "Both A and B are best possible explanations", "correct": true}, {"label": "D", "text": "Both A and B are inappropriate explanations", "correct": false}], "correct_answer": "C. Both A and B are best possible explanations", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Both A and B are best possible explanations The decreased GFR slows the flow rate in the loop of Henle, causing increased reabsorption of the percentage of sodium and chloride ions delivered to the ascending loop of Henle and thereby reducing the concentration of sodium at the Macula densa cells.</p>\n<p><strong>Highyeild:</strong></p><p>This decrease in sodium chloride concentration initiates a signal from the macula densa that has two effects It decreases resistance to blood flow in the afferent arterioles, which raises glomerular hydrostatic pressure and helps return GFR to normal. It increases renin release from the juxtaglomerular cells of the afferent and efferent arterioles, which are the major storage sites for renin. Renin released from these cells then functions as an enzyme to increase the formation of angiotensin I, which is converted to angiotensin II. Finally, angiotensin II constricts the efferent arterioles, thereby increasing glomerular hydrostatic pressure and helping return GFR toward normal.</p>\n<p><strong>Random:</strong></p><p>Explanation for other options:- Option A. Reduction in GFR → reduction in flow rate in the loop of Henle → increased reabsorption of sodium chloride in ascending loop of Henle → reduces the concentration of sodium chloride in macula densa Option B. Decreases resistance to blood flow in the afferent arterioles → raises glomerular hydrostatic pressure → normalizes GFR.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The glomerular filtration rate is the product of the average filtration rate of every single nephron multiplied by the number of nephrons in both kidneys. The glomerular filtration rate is determined by the balance of hydrostatic and colloid osmotic pressure. Select the correct factors that promote glomerular filtration?", "options": [{"label": "A", "text": "The hydrostatic pressure of glomerular capillary", "correct": true}, {"label": "B", "text": "Oncotic pressure of the glomerular capillary", "correct": false}, {"label": "C", "text": "The hydrostatic pressure of Bowman's capsule", "correct": false}, {"label": "D", "text": "Oncotic pressure of Bowman's capsule", "correct": false}], "correct_answer": "A. The hydrostatic pressure of glomerular capillary", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The hydrostatic pressure of glomerular capillary Hydrostatic pressure is the pressure produced by a fluid against a surface. The blood inside the glomerulus creates glomerular hydrostatic pressure which forces fluid out of the glomerulus into the glomerular capsule.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B - Oncotic pressure of the glomerular capillary- The blood flowing into the glomerulus contains plasma proteins and blood cells that displace the water content of the blood. This creates, in effect, a counter-force called oncotic pressure , as the water outside the capillaries seeks to equalize with the water inside the capillaries through osmosis. Option C - Hydrostatic pressure of Bowman's capsule- The absence of proteins in Bowman's space (the lumen within Bowman's capsule) results in an osmotic pressure near zero. Thus, the only pressure moving fluid across the capillary wall into the lumen of Bowman's space is hydrostatic pressure Option D - Oncotic pressure of Bowman's capsule- The blood flowing into the glomerulus contains plasma proteins and blood cells that displace the water content of the blood. This creates, in effect, a counter-force called oncotic pressure, as the water outside the capillaries seeks to equalize with the water inside the capillaries through osmosis.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Myogenic mechanisms regulate the maintenance of a relatively constant renal blood flow and glomerular filtration rate. The mechanism is dependent on the ability of blood vessels to resist stretching during increased arterial pressure. Select the essential elements in the myogenic mechanism?", "options": [{"label": "A", "text": "Small arterioles respond to increased wall stretch by relaxation of the vascular smooth muscle", "correct": false}, {"label": "B", "text": "The stretch of the vascular wall allows increased movement of calcium ions from the extracellular fluid into the cells causing them to contract", "correct": false}, {"label": "C", "text": "This contraction prevents excessive stretch of the vessel and, at the same time, by raising vascular resistance, helps prevent excessive increases in renal blood flow and the GFR when arterial pressure increases", "correct": false}, {"label": "D", "text": "Both B and C", "correct": true}], "correct_answer": "D. Both B and C", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Both B and C Another mechanism that contributes to the maintenance of a relatively constant renal blood flow and GFR is the ability of individual blood vessels to resist stretching during increased arterial pressure, referred to as the myogenic mechanism.</p>\n<p><strong>Highyeild:</strong></p><p>Blood vessels (especially small arterioles) throughout the body have shown that they respond to increased wall tension or wall stretch by contraction of the vascular smooth muscle. The stretch of the vascular wall allows increased movement of calcium ions from the extracellular fluid into the cells, causing them to contract through the mechanisms discussed. This contraction prevents excessive stretch of the vessel and, at the same time, by raising vascular resistance, helps prevent excessive increases in renal blood flow and the GFR when arterial pressure increases</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A - Small arterioles respond to increased wall stretch by contraction of the vascular smooth muscles.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The patient of 34 years reported pain in back muscles over the past 10 days. The patient gave H/O of lifting a heavy load. Examination revealed lumbar spine sprained. The physician prescribed NSAID for 5 days.Select the correct form of NSAID on the GFR of the patient?", "options": [{"label": "A", "text": "GFR increases", "correct": false}, {"label": "B", "text": "GFR reduces", "correct": true}, {"label": "C", "text": "GFR remains unchanged", "correct": false}, {"label": "D", "text": "None", "correct": false}], "correct_answer": "B. GFR reduces", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>GFR reduces In the case of the 34-year-old patient with a lumbar spine sprain, the use of NSAIDs for a short period of 5 days is reducing GFR. NSAIDs block the synthesis of prostaglandins, thus reducing their dilation capability on the afferent arteriole, reducing GFR.</p>\n<p><strong>Highyeild:</strong></p><p>Under normal conditions, Prostaglandins (PGE2 and PGI2) and bradykinin serve as hormones and autacoids that cause vasodilation, increased renal blood flow, and increased GFR. If the patient has normal kidney function and no other risk factors for kidney disease, the use of NSAIDs for a short period is generally safe.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. GFR will not increase Option C. GFR undergoes change</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The kidney maintains a constant renal blood flow rate between 80 and 180 mmHg. The kidney can partly autoregulate this pressure by responding to changes detected by stretch receptors. Select the correct name of the mechanism?", "options": [{"label": "A", "text": "Myogenic mechanism", "correct": true}, {"label": "B", "text": "Myotonic mechanism", "correct": false}, {"label": "C", "text": "Myotactic mechanism", "correct": false}, {"label": "D", "text": "Myoglomerular mechanism", "correct": false}], "correct_answer": "A. Myogenic mechanism", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Myogenic mechanism Another mechanism that contributes to the maintenance of a relatively constant renal blood flow and GFR is the ability of individual blood vessels to resist stretching during increased arterial pressure, referred to as the myogenic mechanism.</p>\n<p><strong>Highyeild:</strong></p><p>The myogenic mechanism is a process by which the smooth muscle cells in the walls of the afferent arterioles in the kidneys can regulate blood flow and pressure to the glomerulus. The mechanism is based on the ability of smooth muscle cells to respond to changes in pressure and stretch.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. Myotonic mechanism Option C. Myotactic mechanism Option D. Myoglomerular mechanism Options B C D are misnomers</p>\n<p><strong>Table:</strong></p><p>Electrolyte disturbances ELECTROLYTE LOW SERUM CONCENTRATION HIGH SERUM CONCENTRATION Sodium Nausea, malaise, stupor, coma,\n seizures Irritability, stupor, coma Potassium U waves and flattened T waves\n on ECG, arrhythmias, muscle cramps, spasm, weakness Wide QRS and peaked T waves on\n ECG, arrhythmias, muscle weakness Calcium Tetany, seizures, QT prolongation,\n twitching (eg, Chvostek sign), spasm (eg, Trousseau sign) Stones (renal), bones (pain),\n groans (abdominal pain), thrones (↑ urinary frequency), psychiatric overtones\n (anxiety, altered mental status)</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Patient of age 23 years reported to a physician with nausea, vomiting, fatigue, flank pain, pain with urination, and visible blood in the urine, frothy urine for the past 12 days. The patient gave H/O taking sulfonamides for the treatment of sore throat in the previous week. Examination and urinalysis led to renal disease. Select the correct one?", "options": [{"label": "A", "text": "Inflammation of glomerulus", "correct": false}, {"label": "B", "text": "Destruction of podocytes, and filtration membrane", "correct": false}, {"label": "C", "text": "The proliferation of mesangial cells", "correct": false}, {"label": "D", "text": "All correct", "correct": true}], "correct_answer": "D. All correct", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>All correct The nephritic syndrome is characterized by blood in the urine (especially Red blood cell casts with dysmorphic red blood cells) and a decrease in the amount of urine in the presence of hypertension.</p>\n<p><strong>Highyeild:</strong></p><p>In this syndrome, inflammatory damage to cells lining the glomerulus is thought to destroy the epithelial barrier, leading to blood being found in the urine. At the same time, reactive changes, e.g. proliferation of mesangial cells That may result in a decrease in kidney blood flow, resulting in a decrease in the production of urine. The renin-angiotensin system may be subsequently activated, because of the decrease in perfusion of the juxtaglomerular apparatus, which may result in hypertension</p>\n<p><strong>Random:</strong></p><p>Explanation for other options:- Option A . inflammation of glomerulus Option B. destruction of podocytes, and filtration the membrane Option C. proliferation of mesangial cells</p>\n<p><strong>Extraedge:</strong></p><p>Typical Features Nephrotic Nephritic Onset Insidious Abrupt Edema ++++ ++ Blood pressure Normal Raised Jugular venous pressure Normal/low Raised Proteinuria ++++ ++ Hematuria May/may not occur +++ Red blood cell casts Absent Present Serum albumin Low Normal/slightly reduced</p>\n<p><strong>Table:</strong></p><p>Nephritic syndrome Nephritic syndrome =\n inflammatory process. Infection-associated glomerulonephritis Formerly called\n post-infectious glomerulonephritis. Type III hypersensitivity\n reaction. Associated with hypocomplementemia (due to consumption). Children:\n most commonly caused by group A streptococcus (poststreptococcal\n glomerulonephritis). Seen ~2-4 weeks after pharyngeal or skin infection.\n strep serologies. Usually resolves spontaneously. Adults: in addition to group A\n streptococcus, can also be caused by staphylococcus. Seen during infection;\n infection site is variable but usually not upper respiratory tract. Must be\n identified on culture as no serologic test available. May progress to renal\n insufficiency. LM-glomeruli enlarged and\n hypercellular A IF-granular (\"starry sky\") appearance\n (\"lumpy-bumpy”) B due to IgG, IgM, and C3 deposition along GBM and\n mesangium EM-subepithelial IC humps IgA nephropathy (Berger\n disease Poor prognosis, rapidly\n deteriorating renal function (days to weeks). LM-crescent moon shape C. Crescents\n consist of fibrin and plasma proteins (eg, C3b) with Rapidly progressive\n (crescentic) glomerulonephritis glomerular parietal cells,\n monocytes, macrophages Several disease processes may\n result in this pattern which may be delineated with IF. Linear IF due to antibodies to\n GBM and alveolar basement membrane: Goodpasture syndrome\n hematuria/hemoptysis; type II hypersensitivity reaction. Treatment:\n plasmapheresis Negative IF/Pauci-immune (no\n IgC3 deposition): granulomatosis with polyangiitis- PR3-ANCA/c-ANCA, eosinophilic\n granulomatosis with polyangiitis or Microscopic polyangiitis-MPO-ANCA/P-ANCA\n Granular IF-PSGN or DPGN Diffuse proliferative\n glomerulonephritis Often due to SLE (think\n \"wire lupus\"). DPGN and MPGN often present as nephrotic syndrome and nephritic syndrome\n concurrently. LM-\"wire looping\" of capillaries D IF-granular;\n EM-subendothelial, sometimes subepithelial or intramembranous IgG-based ICs\n often with C3 deposition Alport syndrome Mutation in type IV collagen\n irregular thinning and thickening and splitting of glomerular basement\n membrane. Most commonly X-linked\n dominant. Eye problems (eg, retinopathy, anterior lenticonus),\n glomerulonephritis, sensorineural deafness; \"can't see, can't pee, can't\n hear a bee.\" • EM-“basket-weave\"\n appearance due to irregular thickening of GBM Membrano- proliferative\n glomerulonephritis MPGN is a nephritic syndrome\n that often co-presents with nephrotic syndrome. Type I may be 2° to hepatitis\n B or C infection. May also be idiopathic. - Subendothelial IC deposits\n with granular IF Type II is associated with C3\n nephritic factor (IgG autoantibody that stabilizes C3 convertase → persistent\n complement activation → C3 levels). • Intramembranous deposits,\n also called dense deposit disease Both types: mesangial ingrowth\n → GBM splitting → “tram-track” on H&E and PAS E stains.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Physiologists studied the permeability of different parts of the nephron. The image shows part of the nephron marked in 3 Number. Select the incorrect ?", "options": [{"label": "A", "text": "Low permeability for sodium and chloride ions", "correct": false}, {"label": "B", "text": "Water high permeability", "correct": false}, {"label": "C", "text": "Water low permeability", "correct": true}, {"label": "D", "text": "Urea moderate permeability", "correct": false}], "correct_answer": "C. Water low permeability", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683534395132-QTDY049026IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Water low permeability Within the nephron of the kidney, the descending limb of the loop of Henle is the portion of the renal tubule constituting the first part of the loop of Henle. It has low permeability for sodium and chloride ions, high permeability for water, and moderate permeability for urea.</p>\n<p><strong>Highyeild:</strong></p><p>The thin descending limb has low permeability to ions and urea while being highly permeable to water. The loop has a sharp bend in the renal medulla going from descending to ascending thin limb. The thin ascending limb is impermeable to water, but it is permeable to ions.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Options A, B, and D are correct</p>\n<p><strong>Table:</strong></p><p>DEFECTS EFFECTS CAUSES NOTES Fanconi syndrome Generalized reabsorption defect in PCT† excretion of amino\n acids, glucose, HCO,-, and PO3-, and all substances reabsorbed by the PCT Metabolic acidosis (proximal RTA),\n hypophosphatemia, hypokalemia Hereditary defects (eg, Wilson disease,\n tyrosinemia, glycogen storage disease), ischemia, multiple myeloma, drugs\n (eg, ifosfamide, cisplatin, tenofovir, expired tetracyclines), lead poisoning Growth retardation and rickets/osteopenia common\n due to hypophosphatemia Volume depletion also common Bartter syndrome Reabsorption defect in thick ascending loop of\n Henle (affects Na+/K+/2C1- cotransporter) Metabolic alkalosis, hypokalemia, hypercalciuria Autosomal recessive Presents similarly to chronic loop diuretic use Gitelman syndrome Reabsorption defect of NaCl in DCT Metabolic alkalosis, hypomagnesemia, hypokalemia,\n hypocalciuria Autosomal recessive Presents similarly to chronic thiazide diuretic\n use Less severe than Bartter syndrome Liddle syndrome Gain of function mutationNa channel degradation\n →↑ Nat reabsorption in collecting tubules Metabolic alkalosis, hypokalemia, hypertension, ↓\n aldosterone Autosomal dominant Presents similarly to hyperaldosteronism, but aldosterone is nearly undetectable Treatment: amiloride Syndrome of Apparent Mineralocorticoid Excess Cortisol activates mineralocorticoid receptors;\n 11ẞ-HSD converts cortisol to cortisone (inactive on these receptors) Hereditary 11ẞ-HSD deficiency cortisol →t\n mineralocorticoid receptor activity Metabolic alkalosis, hypokalemia, hypertension\n serum aldosterone level; cortisol tries to be the SAME as aldosterone Autosomal recessive Can acquire disorder from\n glycyrrhetinic acid (present in licorice), which blocks activity of\n 11ẞ-hydroxysteroid dehydrogenase Treatment: K-sparing diuretics (mineralo-\n corticoid effects) or corticosteroids (exogenous cortico- steroid endogenous\n cortisol production →mineralocorticoid receptor activation)</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following provides the most accurate measure of GFR?", "options": [{"label": "A", "text": "Blood urea nitrogen (BUN)", "correct": false}, {"label": "B", "text": "Endogenous creatinine clearance", "correct": false}, {"label": "C", "text": "Inulin clearance", "correct": true}, {"label": "D", "text": "PAH clearance", "correct": false}], "correct_answer": "C. Inulin clearance", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Inulin clearance Inulin clearance provides the most accurate measure of GFR (glomerular filtration rate) . Inulin is a fructose polysaccharide that is freely filtered by the glomerulus and is not secreted, absorbed, or metabolized by the tubules. Therefore, the clearance of inulin is equal to the GFR.</p>\n<p><strong>Highyeild:</strong></p><p>Inulin clearance is considered the gold standard for measuring GFR because it is an accurate and reliable method that is not affected by factors such as age, sex, muscle mass, or diet. Since inulin is freely filtered by the glomerulus and is not secreted or reabsorbed by the tubules, its clearance is equal to the GFR.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Blood urea nitrogen (BUN) and PAH (para-amino hippuric acid) clearance are not measures of GFR. BUN is a measure of the amount of urea nitrogen in the blood, which is affected by both GFR and the rate of urea production. Option B. Endogenous creatinine clearance is a commonly used estimate of GFR , but it overestimates GFR by about 10-20% due to tubular secretion of creatinine. Option D. PAH clearance is used to estimate renal plasma flow, not GFR.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Renal medullary hyperosmolarity is due to:", "options": [{"label": "A", "text": "Increased interstitial Na", "correct": false}, {"label": "B", "text": "Increased interstitial K", "correct": false}, {"label": "C", "text": "Increased interstitial Na & urea", "correct": false}, {"label": "D", "text": "All of the above", "correct": true}], "correct_answer": "D. All of the above", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>All of the above In juxtamedullary nephrons with longer loops and thin ascending limbs, the osmotic gradient is spread over a greater distance and the osmolality at the tip of the loop is greater. This is because the thin ascending limb is relatively impermeable to water but permeable to Na+ and Cl-</p>\n<p><strong>Highyeild:</strong></p><p>Therefore, Na+ and Cl- move down their concentration gradients into the interstitium, and there is additional passive countercurrent multiplication. The greater the length of the loop of Henle, the greater the osmolality that can be reached at the tip of the medulla. The osmotic gradient in the medullary pyramids would not last long if the Na+ and urea in the interstitial spaces were removed by the circulation. These solutes remain in the pyramids primarily because the vasa recta operate as countercurrent exchangers. Urea contributes to the establishment of the osmotic gradient in the medullary pyramids and to the ability to form concentrated urine in the collecting ducts.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- All of the options are correct.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following does not form a filtration barrier in nephrons:", "options": [{"label": "A", "text": "Podocytes", "correct": false}, {"label": "B", "text": "Endothelial cells", "correct": false}, {"label": "C", "text": "Mesangium", "correct": true}, {"label": "D", "text": "Basement membrane (basal lamina)", "correct": false}], "correct_answer": "C. Mesangium", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Mesangium The mesangium is a part of the glomerulus that provides structural support to the capillaries and helps to regulate blood flow. It does not form a filtration barrier in the nephrons.</p>\n<p><strong>Highyeild:</strong></p><p>The glomerular capillary membrane is similar to that of other capillaries, except that it has three (instead of the usual two) major layers: The endothelium of the capillary, A basement membrane, and A layer of epithelial cells (podocytes) surrounds the outer surface of the capillary basement membrane. Together, these layers make up the filtration barrier, which, despite the three layers, filters several hundred times as much water and solutes as the usual capillary membrane.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Podocytes are specialized cells that have foot-like projections that wrap around the glomerular capillaries, forming a structure called the filtration slit diaphragm. The filtration slit diaphragm is composed of protein molecules such as nephrin and podocin, which act as a final barrier to prevent the passage of large molecules. Option B. The endothelial cells have small fenestrations or pores that allow the passage of small molecules such as water, ions, and small solutes, but prevent the passage of larger molecules such as proteins. Option C. The basement membrane is a dense, negatively charged layer that serves as a physical barrier and also repels negatively charged molecules, such as proteins.</p>\n<p><strong>Table:</strong></p><p>ELECTROLYTE LOW SERUM CONCENTRATION HIGH SERUM CONCENTRATION Sodium Nausea, malaise, stupor, coma,\n seizures Irritability, stupor, coma Potassium U waves and flattened T waves\n on ECG, arrhythmias, muscle cramps, spasm, weakness Wide QRS and peaked T waves on\n ECG, arrhythmias, muscle weakness Calcium Tetany, seizures, QT\n prolongation, twitching (eg, Chvostek sign), spasm (eg, Trousseau sign) Stones ( renal), bones (pain), groans (abdominal pain), thrones (↑\n urinary frequency), psychiatric overtones (anxiety, altered mental status) Magnesium Tetany, torsades de pointes,\n hypokalemia, hypocalcemia (when [Mg2+] < 1.0 mEq/L) + DTRS, lethargy, bradycardia,\n hypotension, cardiac arrest, hypocalcemia Phosphate Bone loss, osteomalacia\n (adults), rickets (children) Renal stones, metastatic\n calcifications, hypocalcemia</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 21-year-old man has been vomiting to the point where he has become hypovolemic, as evidenced by an accompanying decrease in blood pressure and a feeling of light-headedness. The kidneys respond by reducing urinary volume flow, thus limiting the potential extent of hypovolemia. Increases in the plasma levels of which of the following hormones will bring about the most dramatic decrease in urinary volume flow rate?", "options": [{"label": "A", "text": "Angiotensin II", "correct": false}, {"label": "B", "text": "Atrialnatriureticpeptide", "correct": false}, {"label": "C", "text": "Parathyroid Hormone", "correct": false}, {"label": "D", "text": "Arginine vasopressin (ADH)", "correct": true}], "correct_answer": "D. Arginine vasopressin (ADH)", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Arginine vasopressin (ADH) Increases in plasma levels of arginine vasopressin, or ADH, lead to water reabsorption by the collecting ducts, decreasing urine output. In the scenario described, the hypovolemia caused by vomiting would stimulate the release of ADH, which would cause the kidneys to reduce the urinary volume flow rate and conserve water. This would help to maintain blood volume and pressure and prevent further dehydration.</p>\n<p><strong>Highyeild:</strong></p><p>The hormone that would bring about the most dramatic decrease in urinary volume flow rate in response to hypovolemia is the antidiuretic hormone (ADH), also known as vasopressin. ADH is released by the posterior pituitary gland in response to changes in blood volume and pressure. It acts on the kidneys to increase water reabsorption, thereby decreasing urine volume and concentrating the urine. This helps to conserve water and maintain blood volume and pressure during periods of dehydration or hypovolemia.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Other hormones that can affect urinary volume flow rate include aldosterone and atrial natriuretic peptide (ANP). Aldosterone increases sodium reabsorption and potassium secretion in the kidneys, which can indirectly affect water reabsorption and urinary volume. ANP, on the other hand, promotes water and sodium excretion in the kidneys, which would increase the urinary volume flow rate . However, in the scenario described, the most significant hormone involved in regulating urinary volume flow rate would be ADH.</p>\n<p><strong>Extraedge:</strong></p><p>ADH acts on the collecting ducts to increase their water permeability, leading to an increase in water reabsorption from the tubular fluid, bringing about retention of water and an increase in extracellular fluid volume. Aldosterone regulates the reabsorption of sodium (and chloride) from the distal tubule and the cortical collecting duct, bringing about the retention of salt and water and an increase in extracellular fluid volume.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 40 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A 34-week pregnant mother from South Delhi came to your clinic with a report of a decrease in urinary estriol excretion, indicating a decline in fetal adrenal cortical activity. Which of the following is the principal steroid secreted by the fetal adrenal cortex?", "options": [{"label": "A", "text": "Cortisol", "correct": false}, {"label": "B", "text": "Corticosterone", "correct": false}, {"label": "C", "text": "Dehydroepiandrosterone", "correct": true}, {"label": "D", "text": "Pregnenolone", "correct": false}], "correct_answer": "C. Dehydroepiandrosterone", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Dehydroepiandrosterone C: The fetal cortex synthesizes primarily dehydroepiandrosterone . Because it lacks 3β-hydroxysteroid dehydrogenase, the enzyme that converts pregnenolone to progesterone (the initial step in both glucocorticoid and mineralocorticoid synthesis).</p>\n<p><strong>Highyeild:</strong></p><p>This steroid is metabolized further to estrogen and androgen by the placenta. During fetal life, the adrenal cortex consists of a thin subcapsular rim, which eventually gives rise to the adult cortex, and a thick inner fetal cortex, which constitutes 80% of the gland. This zone undergoes rapid involution after birth. Hormones of the adrenal gland:-</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Cortisol : The adrenal gland secretes steroid hormones such as cortisol and aldosterone. Option B. Corticosterone is the hormone of the pituitary adrenocortical axis secreted by the adrenal cortex. Option D. Pregnenolone is a hormone naturally produced in the body by the adrenal gland. Pregnenolone is also made from cholesterol.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Through what “permissive action” do glucocorticoids accelerate gluconeogenesis during fasting?", "options": [{"label": "A", "text": "Glucocorticoids stimulate the secretion of insulin, which activates gluconeogenic enzymes in the liver.", "correct": false}, {"label": "B", "text": "Glucocorticoids inhibit the use of glucose by skeletal muscle.", "correct": false}, {"label": "C", "text": "Glucocorticoids maintain the vascular response to norepinephrine.", "correct": false}, {"label": "D", "text": "Glucocorticoids maintain the intracellular concentrations of many of the enzymes needed to carry out gluconeogenesis through effects on transcription.", "correct": true}], "correct_answer": "D. Glucocorticoids maintain the intracellular concentrations of many of the enzymes needed to carry out gluconeogenesis through effects on transcription.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Glucocorticoids maintain the intracellular concentrations of many of the enzymes needed to carry out gluconeogenesis through effects on transcription.</p>\n<p><strong>Highyeild:</strong></p><p>The glucocorticoids are necessary for glucagon to exert its gluconeogenic action during fasting. They are gluconeogenic themselves, but their role is mainly permissive. In adrenal insufficiency, the blood glucose is normal as long as food intake is maintained, but fasting precipitates hypoglycemia and collapses. The plasma-glucose-lowering effect of insulin is greatly enhanced in patients with adrenal insufficiency. In animals with experimental diabetes, adrenalectomy markedly ameliorates diabetes. The major diabetogenic effects are - an increase in protein catabolism with increased gluconeogenesis in the liver; increased hepatic gluconeogenesis and ketogenesis; and a decrease in peripheral glucose utilization relative to the blood insulin level that may be due to inhibition of glucose phosphorylation.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest options are inappropriate because Glucocorticoids maintain the intracellular concentrations of many of the enzymes needed to carry out gluconeogenesis through effects on transcription. <br</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following statements is false?", "options": [{"label": "A", "text": "90% of the cortisol is bound to plasma proteins.", "correct": false}, {"label": "B", "text": "Cortisol has a half-life of 60-90 minutes.", "correct": false}, {"label": "C", "text": "Aldosterone has a half-life of about 20 minutes.", "correct": false}, {"label": "D", "text": "80% of the aldosterone is bound to plasma proteins.", "correct": true}], "correct_answer": "D. 80% of the aldosterone is bound to plasma proteins.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>80% of the aldosterone is bound to plasma proteins. 60% of aldosterone is bound to plasma proteins, not 80%.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. 90% of cortisol is bound to plasma proteins. Most of it is bound to transcortin, a corticosteroid-specific a2 globulin, and the rest to albumin. Option B. This high degree of binding to plasma proteins slows the elimination of cortisol. Therefore, cortisol has a longer half-life of 60 to 90 minutes. Option C. Since only about 60% of aldosterone is in bound form, it has a relatively short half-life of about 20 minutes.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following is not an action of cortisol?", "options": [{"label": "A", "text": "Stimulates gluconeogenesis", "correct": false}, {"label": "B", "text": "Increased protein catabolism", "correct": false}, {"label": "C", "text": "Stimulates lipogenesis", "correct": false}, {"label": "D", "text": "Increased number of T-lymphocytes", "correct": true}], "correct_answer": "D. Increased number of T-lymphocytes", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Increased number of T-lymphocytes Cortisol suppresses the proliferation of T-lymphocytes and decreases the number of T-Lymphocytes.</p>\n<p><strong>Highyeild:</strong></p><p>Actions of Cortisol:- Metabolic Effects Effect on carbohydrates: Exert an anti-insulin effect leading to hyperglycemia Increases gluconeogenesis Increases glycogen synthesis Decreases utilization of glucose in peripheral tissues Effect on fat: promotes mobilization of fatty acids from adipose tissue in acute states. This mobilization increases the concentration of free fatty acids in the plasma, which also increases their utilization of energy, causing lipolysis. However, in chronic states cortisol has more lipogenic effect than lipolytic, causing central obesity and buffalo hump. Effect on protein: Exerts a catabolic effect and causes proteolysis Effect on water and electrolytes: Sodium water retention and diuresis Effect on appetite: Increases the appetite and food intake by inducing the synthesis of neuropeptide-Y. Anti-inflammatory and immunosuppressive effects: Induce the synthesis of lipocortin, an inhibitor of phospholipase A2. Inhibit the release of histamine and serotonin. Inhibit the production of IL-2 and T lymphocytes, and depress cellular immunity. Maintenance of vascular responsiveness to catecholamines:- Cortisol up-regulates a1 receptors on arterioles, increasing their sensitivity to the vasoconstrictor effect of norepinephrine.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest options are correct; only incorrect options are explained Cortisol suppresses the proliferation of T-lymphocytes and decreases the number of T-Lymphocytes.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 14 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "Hospitalized Mr. Bishnoi Resident of district Sanchore found semi-comatose. Arterial blood gasses reveal hypercapnia. Which of the following is the most likely cause of the high arterial PCO2?", "options": [{"label": "A", "text": "Decreased metabolic activity", "correct": false}, {"label": "B", "text": "Decreased alveolar dead space", "correct": false}, {"label": "C", "text": "Profound hypoxia", "correct": true}, {"label": "D", "text": "Alveolar capillary block", "correct": false}], "correct_answer": "C. Profound hypoxia", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Profound hypoxia Profound hypoxia refers to a severe lack of oxygen supply to the body's tissues and organs, which can result in organ failure, tissue damage, and even death if not treated promptly . Hypoxia occurs when there is an inadequate amount of oxygen reaching the body's cells and tissues, leading to a decrease in cellular respiration and energy production.</p>\n<p><strong>Highyeild:</strong></p><p>Profound hypoxia depresses the central nervous system, including the medullary respiratory centers. As a result, alveolar ventilation may decrease, resulting in an increased PaCO2. Chronic hypoxia could bring about serious damage to medullary respiratory centers by aggravating oxidative stress and increasing cell apoptosis.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A . A decrease in metabolic activity would decrease the rate of production of carbon dioxide (VCO2), which would decrease PaCO2, assuming that alveolar ventilation does not change. Option B. At a constant tidal volume and respiratory rate, a decrease in the dead-space volume would increase alveolar ventilation, and thus lower the PaCO2. Option D. If an alveolar-capillary block is severe, retention of CO2 could briefly occur, but the coexistent hypoxemia would cause reflex hyperventilation with a decrease in PaCO2.</p>\n<p><strong>Extraedge:</strong></p><p>Hypoxia ↓O, delivery to tissues. Commonly due to cardiac output, hypoxemia, ischemia, anemia, CO/ cyanide poisoning. Mechanism of hypoxia: NORMAL A-a GRADIENT INCREASED A-a GRADIENT ↓inspired oxygen tension (Pio 2 )- PIO, FIO, x (P B - P H₂O ); most commonly = due to ↓PB in high altitude Hypoventilation (due to increased Paco)- PAO 2 = PIO 2 , Paco, /RQ (eg, CNS depression, = obesity hypoventilation syndrome, muscular weakness) Diffusion limitation (eg, fibrosis) VIQ mismatch-normal perfusion in areas of decreased ventilation Right-to-left shunt-normal perfusion in areas of no ventilation. Can be anatomic (eg, intracardiac shunt) or physiologic (eg, perfusion of nonventilated alveoli in ARDS) Hypoxemia Insufficient oxygenation of blood (↓ Pao 2 ).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 32-year-old mountaineer has a hematocrit of 60. He is likely to have:", "options": [{"label": "A", "text": "Progressive hemodilution", "correct": false}, {"label": "B", "text": "High-altitude pulmonary edema", "correct": false}, {"label": "C", "text": "High-altitude cerebral edema", "correct": false}, {"label": "D", "text": "Polycythemia", "correct": true}], "correct_answer": "D. Polycythemia", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Polycythemia This is a case of secondary polycythemia. A hematocrit of 60 in a mountaineer suggests polycythemia, which is an increase in the number of red blood cells in the blood. This is a common physiological response to high-altitude hypoxia, where the body tries to compensate for the reduced oxygen supply by producing more red blood cells to carry more oxygen.</p>\n<p><strong>Highyeild:</strong></p><p>Polycythemia can improve the body's oxygen-carrying capacity but can also increase blood viscosity, which may impair circulation and increase the risk of blood clots. In severe cases, it can lead to thrombosis, stroke, and heart attack.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A: Progressive hemodilution is the opposite of polycythemia, where the concentration of red blood cells decreases. This condition is unlikely to occur in a mountaineer at a high-altitude. Option B & C: High altitude pulmonary edema and high-altitude cerebral edema are both severe and potentially life-threatening altitude illnesses that can occur in mountaineers at high-altitudes due to exposure to low oxygen levels. These conditions are not related to an increase in hematocrit.</p>\n<p><strong>Extraedge:</strong></p><p>The cardiac output often increases as much as 30 percent immediately after a person ascends to high altitude but then decreases back toward normal over a period of weeks as the blood hematocrit increases, so the amount of O2 transported to the peripheral body tissues remains about normal. Hypoxia is the principal stimulus for causing an increase in red blood cell production. Ordinarily, when a person remains exposed to low O2 for weeks at a time, the hematocrit rises slowly from a normal value of 40 to 45 to an average of about 60.</p>\n<p><strong>Table:</strong></p><p>Oxygen content of blood O 2 content =( O , bound to hemoglobin) + (O 2 solubilized in plasma) = (1.34HbSa*O 2 +(0.003 blood * Pa*O_{2} ) . Sao, percent saturation of arterial blood with O_{2} 0.003 = solubility constant of O_{2} Pao, = partial pressure of O_{2} in\narterial blood. Normally 1 g Hb can bind 1.34 mL O_{2} normal Hb amount in blood is 15\ng/dL. O_{2} binding (carrying) capacity≈ approx 20 mL O_{2} / d * L of blood. WithHb there is ↓ O_{2} content of arterial blood, but no change in\nO_{2} saturation and Pao,. O_{7} delivery to tissues = cardiac output x O_{2}\ncontent of blood. Hb CONCENTRATION Sao Pao TOTAL O, CONTENT CO poisoning Normal Normal ↓ Anemia ↓ Normal Normal ↓ Polycythemia ↑ Normal Normal ↑ Methemoglobinemia Normal ↓F e 3+ poor at binding O₁) Normal ↓ Cyanide toxicity Normal Normal Normal Normal Response to high altitude Constant Fio, but PB →↓ atmospheric oxygen (Pio,)→\nPao,→ ↑ ventilation →↓ Paco₂ → respiratory alkalosis → altitude sickness\n(headaches, nausea, fatigue, lightheadedness, sleep disturbance). Chronic ↑ in ventilation. ↑ erythropoietin → ↑ Hct and Hb (due to chronic\nhypoxia). ↑ 2,3-BPG (binds to Hb → rightward shift of oxyhemoglobin\ndissociation curve → ↑ O, release). Cellular changes († mitochondria). ↑ renal excretion of HCO, to compensate for\nrespiratory alkalosis (can augment with acetazolamide). Chronic hypoxic pulmonary vasoconstriction → ↑\npulmonary vascular resistance → pulmonary hypertension, right ventricular\nhypertrophy (RVH).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The earliest change in high altitude is?", "options": [{"label": "A", "text": "Hyperventilation", "correct": true}, {"label": "B", "text": "Decrease in work capacity", "correct": false}, {"label": "C", "text": "Drowsiness", "correct": false}, {"label": "D", "text": "Polycythemia", "correct": false}], "correct_answer": "A. Hyperventilation", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Hyperventilation The earliest change that occurs at high altitudes is hyperventilation , which is an increase in the rate and depth of breathing in response to the decreased oxygen concentration in the air . The body attempts to compensate for the reduced oxygen by breathing more rapidly and deeply, which can cause a decrease in carbon dioxide levels in the blood (hypocapnia) and respiratory alkalosis.</p>\n<p><strong>Highyeild:</strong></p><p>Hyperventilation usually starts within hours of arrival at a high altitude and is more pronounced during physical activity. It can lead to symptoms such as lightheadedness, shortness of breath, and tingling in the fingers and around the mouth.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Other changes that can occur at high altitudes include decreased work capacity due to decreased oxygen availability, drowsiness or fatigue due to poor sleep quality, and polycythemia due to increased production of red blood cells in response to the reduced oxygen levels. However, these changes usually occur over a longer period, ranging from days to weeks, after exposure to high altitudes.</p>\n<p><strong>Extraedge:</strong></p><p>Acclimatization to altitude is due to the operation of a variety of compensatory mechanisms. The respiratory alkalosis produced by the hyperventilation shifts the oxygen–hemoglobin dissociation curve to the left, but a concomitant increase in red blood cell 2,3-BPG tends to decrease the O2 affinity of The net effect is a small increase in P50. The decrease in O2 affinity makes more O2 available to the tissues. However, the value of the increase in P50 is limited because when the arterial PO2 is markedly reduced, the decreased O2 affinity also interferes with O2 uptake by hemoglobin in the lungs. The initial ventilatory response to increased altitude is relatively small because the alkalosis tends to counteract the stimulating effect of hypoxia.</p>\n<p><strong>Table:</strong></p><p>Response to high altitude Constant Fio, but PB →↓ atmospheric oxygen\n(Pio,)→ Pao,→ ↑ ventilation →↓ Paco₂ → respiratory alkalosis → altitude sickness\n(headaches, nausea, fatigue, lightheadedness, sleep disturbance). Chronic ↑ in ventilation. ↑ erythropoietin → ↑ Hct and Hb (due to chronic\nhypoxia). ↑ 2,3-BPG (binds to Hb → rightward shift of oxyhemoglobin\ndissociation curve → ↑ O, release). Cellular changes († mitochondria). ↑ renal excretion of HCO, to compensate for\nrespiratory alkalosis (can augment with acetazolamide). Chronic hypoxic pulmonary vasoconstriction → ↑\npulmonary vascular resistance → pulmonary hypertension, right ventricular\nhypertrophy (RVH).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Hypoxia causes vasoconstriction in:", "options": [{"label": "A", "text": "Muscle", "correct": false}, {"label": "B", "text": "Lungs", "correct": true}, {"label": "C", "text": "Liver", "correct": false}, {"label": "D", "text": "Spleen", "correct": false}], "correct_answer": "B. Lungs", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Lungs Hypoxia (a lack of oxygen supply) can cause vasoconstriction (narrowing of blood vessels) in the lungs. This is because the lungs regulate the amount of oxygen that is delivered to the body, and vasoconstriction helps to redirect blood flow to areas of the lung where oxygen exchange is more efficient.</p>\n<p><strong>Highyeild:</strong></p><p>Vasoconstriction in the lungs can also help to reduce the amount of blood that reaches areas of the lung that are poorly ventilated, such as areas affected by pneumonia or bronchitis. This is known as hypoxic pulmonary vasoconstriction (HPV) or the \"zone of hypoxia.\" HPV helps to maintain adequate oxygenation of the blood and prevent hypoxemia (low oxygen levels in the blood).</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Hypoxia can cause vasodilation (widening of blood vessels) in other organs such as muscles, liver, and spleen which helps to increase blood flow and oxygen delivery to these tissues. Vasodilation helps to deliver more oxygen and nutrients to the tissues to compensate for the lack of oxygen supply due to hypoxia.</p>\n<p><strong>Extraedge:</strong></p><p>Hypoxia ↓O, delivery to tissues. Commonly due to cardiac output, hypoxemia, ischemia, anemia, CO/ cyanide poisoning. Mechanism of hypoxia: NORMAL A-a GRADIENT INCREASED A-a GRADIENT ↓inspired oxygen tension (Pio 2 )- PIO, FIO, x (P B - P H₂O ); most commonly = due to ↓PB in high altitude Hypoventilation (due to increased Paco)- PAO 2 = PIO 2 , Paco, /RQ (eg, CNS depression, = obesity hypoventilation syndrome, muscular weakness) Diffusion limitation (eg, fibrosis) VIQ mismatch-normal perfusion in areas of decreased ventilation Right-to-left shunt-normal perfusion in areas of no ventilation. Can be anatomic (eg, intracardiac shunt) or physiologic (eg, perfusion of nonventilated alveoli in ARDS) Hypoxemia Insufficient oxygenation of blood (↓ Pao 2 ).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 14 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A 62-year-old woman eats a high-carbohydrate meal. Her plasma glucose concentration rises, and this results in increased insulin secretion from the pancreatic islet cells. The insulin response is an example of:", "options": [{"label": "A", "text": "Chemical equilibrium", "correct": false}, {"label": "B", "text": "End-product inhibition", "correct": false}, {"label": "C", "text": "Feedforward control", "correct": false}, {"label": "D", "text": "Negative feedback", "correct": true}], "correct_answer": "D. Negative feedback", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Negative feedback In most instances, t his control is exerted through negative feedback mechanisms that ensure a proper level of hormone activity at the target tissue. After a stimulus causes the release of the hormone, conditions or products resulting from the action of the hormone tend to suppress its further release. In other words, the hormone (or one of its products) has a negative feedback effect to prevent over-secretion of the hormone or overactivity at the target tissue.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest options are incorrect because the hormone has a negative feedback effect to prevent over-secretion of the hormone or overactivity at the target tissue.</p>\n<p><strong>Extraedge:</strong></p><p>Positive feedback: Positive feedback is the amplification of a body's response to a stimulus. For example, in childbirth, when the head of the fetus pushes up against the cervix it stimulates a nerve impulse from the cervix to the brain.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 45-year-old lady comes to your clinic with a complaint of difficulty to see at night. Her eye Image is given below. She has darkening of the skin at neck, and coarse thick hair on her face. What is the cause of her disease?", "options": [{"label": "A", "text": "Metal deposit", "correct": false}, {"label": "B", "text": "Receptor resistance", "correct": true}, {"label": "C", "text": "Metabolite imbalance", "correct": false}, {"label": "D", "text": "Genetic disease", "correct": false}], "correct_answer": "B. Receptor resistance", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/questionImage-1735982659846-photos-1693549306238-QTDY022002IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Receptor resistance The image shows a snowflake cataract seen in Diabetes Mellitus. The given clinical scenario is diabetes mellitus due to insulin resistance. Other features are suggestive of Metabolic syndrome due to Insulin Resistance.</p>\n<p><strong>Highyeild:</strong></p><p>Glucose is reduced to Sorbitol (hygroscopic substance) by the Aldolase reductase enzyme. Sorbitol is dehydrogenated to fructose by the Sorbitol dehydrogenase enzyme. Since most cells in our body do not have Sorbitol dehydrogenase, in diabetes(when the glucose level is increased) Sorbitol gets accumulated in cells, especially lenses. Since Sorbitol is a hygroscopic substance, it leads to the formation of the cataract which is like a Snowflake.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A: Copper gets deposited on the lens and cause sunflower cataract in Wilson’s disease . Option C: It causes oil droplet cataract. Option D: Myotonic dystrophy causes Christmas tree cataracts</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 64-year-old male visits a physician complaining of a tingling sensation in his lower limbs. Doctor took more history from the patient and it was known that the patient has been a known diabetic for the last 10 years and was on oral antidiabetic drugs. Despite taking drugs regularly, his sugar was not under control. The doctor prescribed insulin injections to the patient before eating. What will be the mechanism of Insulin to work?", "options": [{"label": "A", "text": "Acts through cell surface receptors", "correct": true}, {"label": "B", "text": "Acts through ion channels", "correct": false}, {"label": "C", "text": "Acts through GLUT", "correct": false}, {"label": "D", "text": "Acts through aquaporins", "correct": false}], "correct_answer": "A. Acts through cell surface receptors", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Acts through cell surface receptors Insulin is a water-soluble hormone so cannot enter the cell directly but they act from outside via cell surface receptors. So, option A is correct.</p>\n<p><strong>Highyeild:</strong></p><p>Insulin acts on the Tyrosine kinase Insulin acts on specific receptors located on the cell membrane of practically every cell, but their density depends on the cell type: liver and fat cells are very rich. The insulin receptor is a hetero-tetrameric glycoprotein consisting of 2 extracellular α and 2 transmembrane β subunits linked together by disulfide bonds. It is oriented across the cell membrane as a heterodimer. The α subunits carry insulin binding sites, while the β subunits have tyrosine-protein kinase activity.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B: Ion channels are also a function of protein in the cell membrane and they help the entry of ions into the cell. So not a correct option for the question. Option C: GLUT helps transport glucose inside the cell. So incorrect option. Option D: Aquaporins or water channels help in the entry of water into the cel So incorrect option</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Glucose-mediated insulin release is mediated through:", "options": [{"label": "A", "text": "ATP-sensitive K+ channels", "correct": true}, {"label": "B", "text": "cAMP", "correct": false}, {"label": "C", "text": "Carrier modulators", "correct": false}, {"label": "D", "text": "Receptor phosphorylation", "correct": false}], "correct_answer": "A. ATP-sensitive K+ channels", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>ATP-sensitive K+ channels Glucose acts directly on pancreatic B cells to increase insulin secretion . The response to glucose is biphasic; there is a rapid but short-lived increase in the secretion followed by a more slowly developing prolonged increase. Glucose enters the B cells via GLUT 2 transporters and is phosphorylated by glucokinase then metabolized to pyruvate in the cytoplasm. The pyruvate enters the mitochondria and is metabolized to CO2 and H2O via the citric acid cycle with the formation of ATP by oxidative phosphorylation. The ATP enters the cytoplasm, where it inhibits ATP-sensitive K+ channels, reducing K+ efflux. This depolarizes the B cell, and Ca2+ enters the cell via voltage-gated Ca2+ channels. The Ca2+ influx causes exocytosis of a readily releasable pool of insulin-containing secretory granules, producing the initial spike of insulin secretion.</p>\n<p><strong>Highyeild:</strong></p><p>Insulin acts on the Tyrosine kinase Receptors. Insulin acts on specific receptors located on the cell membrane of practically every cell, but their density depends on the cell type: liver and fat cells are very rich. The insulin receptor is a hetero-tetrameric glycoprotein consisting of 2 extracellular α and 2 transmembrane β subunits linked together by disulfide bonds. It is oriented across the cell membrane as a heterodimer. The α subunits carry insulin binding sites, while the β subunits have tyrosine-protein kinase activity.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. cAMP, cAMP is generally considered as an amplifier of insulin secretion triggered by Ca2+ elevation in the β-cells. Option C. Insulin in the blood is taken up through a transporter GLUT4. Option D. The function of insulin receptor substrate-1 (IRS-1) is regulated by both tyrosine and serine/threonine phosphorylation.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following statements is false?", "options": [{"label": "A", "text": "Insulin causes K+ to enter cells, decreasing K+ in ECF", "correct": false}, {"label": "B", "text": "Insulin receptors are decreased during starvation", "correct": true}, {"label": "C", "text": "Affinity of insulin receptors is decreased in adrenal insufficiency", "correct": false}, {"label": "D", "text": "D. Insulin promotes fat synthesis", "correct": false}], "correct_answer": "B. Insulin receptors are decreased during starvation", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Insulin receptors are decreased during starvation Both insulin and glucagon function as important feedback control systems for maintaining a normal blood glucose concentration. When the glucose concentration rises too high, increased insulin secretion causes blood glucose concentration to decrease toward normal . Insulin receptors are decreased in starvation: Insulin receptors are increased in starvation. Insulin receptors are increased in starvation to allow glucose entry into the cells.</p>\n<p><strong>Highyeild:</strong></p><p>Conversely, a decrease in blood glucose stimulates glucagon secretion; the glucagon then functions in the opposite direction to increase glucose toward normal. Under most normal conditions, the insulin feedback mechanism is more important than the glucagon mechanism, but in instances of starvation or excessive utilization of glucose during exercise and other stressful situations, the glucagon mechanism also becomes valuable.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Insulin causes K+ to enter cells, decreasing K+ in ECF: That is why Insulin along with glucose is given in cases of Hyperkalemia to prevent arrhythmia. Option C. Affinity of insulin receptors is decreased in adrenal insufficiency: The release of adrenaline activates specific physiological reactions, which are intended to prepare the body to respond to the perceived stressor or threat including stimulation of the liver to break down glycogen into glucose (to provide quick energy to the body). Option D. Insulin promotes fat synthesis: insulin is a lipogenic hormone.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following is secreted by beta cells of the pancreas along with insulin?", "options": [{"label": "A", "text": "Somatostatin", "correct": false}, {"label": "B", "text": "Amylin", "correct": true}, {"label": "C", "text": "Pancreatic polypeptide", "correct": false}, {"label": "D", "text": "Glucose-like peptide", "correct": false}], "correct_answer": "B. Amylin", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Amylin The beta cells also secrete the hormone Amylin and called C-peptide, a byproduct of insulin production . Amylin slows the rate of glucose entering the bloodstream , making it a more short-term regulator of blood glucose levels.</p>\n<p><strong>Highyeild:</strong></p><p>The islets contain three major types of cells: alpha, beta, and delta cells, that are distinguished from one another by their morphological and staining characteristics. The beta cells, constituting about 60 percent of all the cells of the islets, lie mainly in the middle of each islet and secrete insulin and amylin, a hormone that is often secreted in parallel with insulin, although its function is not well understood. The alpha cells, about 25 percent of the total, secrete glucagon, and the delta cells, about 10 percent of the total, secrete somatostatin.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Somatostatin (SST) potently inhibits insulin and glucagon release from pancreatic islets. Option C. PP exerts the inhibitory role in pancreatic exocrine secretion by modulating insulin action. Option D. Glucagon-like peptide 1 encourages the release of insulin from the pancreas, increases the volume of cells in the pancreas that produce insulin (beta cells), and reduces the release of glucagon.</p>\n<p><strong>Table:</strong></p><p>Islets of Langerhans are collections of 𝝰 , 𝛃 and δ endocrine cells. Islets arise from pancreatic\nbuds. 𝝰 = glucagon (peripheral) 𝛃 = insulin (central) δ = somatostatin (interspersed)</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "For cells of islets of Langerhans, which of the following is correctly matched?", "options": [{"label": "A", "text": "B -somatostatin", "correct": false}, {"label": "B", "text": "D- glucagon", "correct": false}, {"label": "C", "text": "F- pancreatic polypeptide", "correct": true}, {"label": "D", "text": "A - insulin", "correct": false}], "correct_answer": "C. F- pancreatic polypeptide", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>F- pancreatic polypeptide The correctly matched pair is F- Pancreatic polypeptide.</p>\n<p><strong>Highyeild:</strong></p><p>The islets of Langerhans contain four cell types that each secrete a different peptide: alpha cells secrete glucagon, beta cells secrete insulin, delta cells secrete somatostatin, and P (F) cells secrete pancreatic polypeptide.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Cells of the endocrine pancreas are divided into: Cell type What they secrete A (alpha) Glucagon B (beta) Insulin and amylin D (delta) Somatostatin For PP Pancreatic polypeptide</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 17 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "In the shown histological gross image, the axon of the neuron pointed with a Circle is inhibitory to which of the following?", "options": [{"label": "A", "text": "Basal ganglia", "correct": false}, {"label": "B", "text": "Cerebellar nuclei", "correct": true}, {"label": "C", "text": "Vestibular nuclei", "correct": false}, {"label": "D", "text": "Red nucleus", "correct": false}], "correct_answer": "B. Cerebellar nuclei", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683532198267-QTDY012001IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Cerebellar nuclei The circled cell bodies are Purkinje cells, a class of GABAergic neurons located in the cerebellum</p>\n<p><strong>Highyeild:</strong></p><p>Purkinje cells send inhibitory projections to the deep cerebellar nuclei and constitute the sole output of all motor coordination in the cerebellar cortex. Cerebellar cortex features: The most prominent feature of the cerebellar cortex is the granule cell layer, composed of vast numbers of very small neurons called granule cells. Each granule cell has a few short dendrites within the granule cell layer. Each granule cell axon projects into the molecular layer and bifurcates into parallel fibers which extend parallel to the long axis of each folium. Above the granule cell layer lies the molecular layer, consisting almost entirely of granule cell axons together with Purkinje cell dendrites (and with relatively few cell bodies). At the boundary between granule cells and molecular layers are found the cell bodies of Purkinje cells, the sole output cells of the cerebellar cortex. Axons enter and leave the cortex through the underlying white matter.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Histological sections of the basal ganglia with hematoxylin staining, 1. globus pallidus interna, 2. globus pallidus externa, and 3. putamen. b Mild calcification. c Moderate calcification. d Severe calcification Option: C. Representative images of the vestibular nuclei Option: D. Red Nuclei</p>\n<p><strong>Extraedge:</strong></p><p>The cerebellar cortex has three layers: an external molecular layer, a Purkinje cell layer that is only one cell thick, and an internal granular layer. There are five types of neurons in the cortex: Purkinje, granule, basket, stellate, and Golgi cells. The Purkinje cells are among the largest neurons in the CNS. They have extensive dendritic arbors that extend throughout the molecular layer. Their axons, which are the only output from the cerebellar cortex, project to the deep cerebellar nuclei, especially the dentate nucleus, where they form inhibitory synapses. They also make inhibitory connections with neurons in the vestibular nuclei. The cerebellar granule cells, whose cell bodies are in the granular layer, receive excitatory input from the mossy fibers and innervate the Purkinje cells. Each sends an axon to the molecular layer, where the axon bifurcates to form a T. The branches of the T are straight and run long distances; thus, they are called parallel fibers. The dendritic trees of the Purkinje cells are markedly flattened and oriented at right angles to the parallel fibers. The parallel fibers form excitatory synapses on the dendrites of many Purkinje cells, and the parallel fibers and Purkinje dendritic trees form a grid of remarkably regular proportions. The other three types of neurons in the cerebellar cortex are inhibitory interneurons. Basket cells are located in the molecular layer. They receive excitatory input from the parallel fibers and each project to many Purkinje cells. Their axons form a basket around the cell body and the axon hillock of each Purkinje cell they innervate. Stellate cells are similar to basket cells but are located in the more superficial molecular layer. Golgi cells are located in the granular layer. Their dendrites project into the molecular layer and receive excitatory input from the parallel fibers.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Non-neuronal cells in the brain and spinal cord with features like numerous projections linking neurons to their blood supply and forming a blood-brain barrier. A 23-week-old fetal brain was cultured and the image given below represents features such as, Select the correct:-", "options": [{"label": "A", "text": "Microglia", "correct": false}, {"label": "B", "text": "Astrocytes", "correct": true}, {"label": "C", "text": "Oligodendrocytes", "correct": false}, {"label": "D", "text": "Bipolar neurons", "correct": false}], "correct_answer": "B. Astrocytes", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683532198394-QTDY012002IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Astrocytes A 24-week-old fetal brain culture shows human astrocytes in the image. Astrocytes are a sub-type of glial cells in the central nervous system. Star-shaped, their many processes envelop synapses made by neurons.</p>\n<p><strong>Highyeild:</strong></p><p>The most abundant type of microglial cell in the CNS, astrocytes (also called astroglia) have numerous projections that link neurons to their blood supply while forming the blood-brain barrier. They regulate the external chemical environment of neurons by removing excess potassium ions, and recycling neurotransmitters released during synaptic transmission. Astrocytes may regulate vasoconstriction and vasodilation by producing substances such as arachidonic acid, whose metabolites are vasoactive.</p>\n<p><strong>Random:</strong></p><p>Explanation for incorrect options: - Option: A. Microglia are the primary innate immune effector cells of the CNS and they represent a unique myeloid cell population whose origin and function must be clearly distinguished from other phagocytes in the brain. Option C. Oligodendrocytes are cells that coat axons in the central nervous system (CNS) with their cell membrane, forming a specialized membrane differentiation called myelin, producing the myelin sheath. The myelin sheath provides insulation to the axon that allows electrical signals to propagate more efficiently Option D. Bipolar neurons- A neuron with only two extensions—an axon and a dendrite—that run from opposite sides of the cell body.</p>\n<p><strong>Extraedge:</strong></p><p>Most common glial cell type in CNS. Physical support, repair, removal of the excess neurotransmitters, a component of the blood-brain barrier, glycogen fuel reserve buffer. Reactive gliosis in response to neural injury. It's derived from neuroectoderm. Astrocyte marker: GFAP.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Principal glia of the peripheral nervous system (PNS). These are types of myelinating and non-myelinating. Myelinating cells wrap around axons of motor and sensory neurons to form the myelin sheath. The image below represents the features:-", "options": [{"label": "A", "text": "Schwan cells", "correct": true}, {"label": "B", "text": "Microglial cells", "correct": false}, {"label": "C", "text": "Oligodendrocytes", "correct": false}, {"label": "D", "text": "All incorrect", "correct": false}], "correct_answer": "A. Schwan cells", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Schwan cells Schwann cells or neurolemmocytes are the principal glia of the peripheral nervous system (PNS). Glial cells function to support neurons and in the PNS, also include satellite cells, olfactory ensheathing cells, enteric glia, and glia that reside at sensory nerve endings, such as the Pacinian corpuscle.</p>\n<p><strong>Highyeild:</strong></p><p>The two types of Schwann cells are myelinated and unmyelinated. Myelinating Schwann cells wrap around axons of motor and sensory neurons to form the myelin sheath. The Schwann cell promoter is present in the downstream region of the human dystrophin gene that gives shortened transcripts that are again synthesized in a tissue-specific manner. During the development of the PNS, the regulatory mechanisms of myelination are controlled by the feedforward interaction of specific genes, influencing transcriptional cascades and shaping the morphology of the myelinated nerve fibers</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: B. Microglia cells are the primary innate immune effector cells of the CNS and they represent a unique myeloid cell population whose origin and function must be clearly distinguished from other phagocytes in the brain. Option: C. Oligodendrocytes are cells that coat axons in the central nervous system (CNS) with their cell membrane, forming a specialized membrane differentiation called myelin, producing the myelin sheath. The myelin sheath provides insulation to the axon that allows electrical signals to propagate more efficiently</p>\n<p><strong>Extraedge:</strong></p><p>Each “Schwann” cell myelinates only 1 PNS axon. Injured in Guillain-Barré syndrome. Schwann cell marker: S100. Promote axonal regeneration. It’s derived from the neural</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A patient of 32 years of age reported to a physician with numbness, tingling, and pain in the legs and arms on both sides. The patient reported successive worsening of the symptoms over 3 weeks. The neurological examination revealed reduced strength of muscles and absence of tendon reflexes. The probable diagnosis was Guillain–Barré syndrome. Select the correct:", "options": [{"label": "A", "text": "Myelin protein zero destruction", "correct": false}, {"label": "B", "text": "Increased incidence after viral infection in the body", "correct": false}, {"label": "C", "text": "Intravenous immunoglobulins or plasmapheresis, together with supportive care is helpful", "correct": false}, {"label": "D", "text": "All correct", "correct": true}], "correct_answer": "D. All correct", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>All correct Guillain–Barré syndrome (GBS) is a rapid-onset muscle weakness caused by the immune system damaging the peripheral nervous system. Typically, both sides of the body are involved, and the initial symptoms are changes in sensation or pain often in the back along with muscle weakness, beginning in the feet and hands, often spreading to the arms and upper body Myelin protein zero (P0) and a hydrophobic protein PMP22 are components of the myelin sheath in the peripheral nervous system. Autoimmune reactions to these proteins cause Guillain–Barré syndrome, a peripheral demyelinating neuropathy</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- All Options are correct as explained above.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The protective mechanism restricts the passage of pathogens, the diffusion of solutes in the blood, and large or hydrophilic molecules into the cerebrospinal fluid while allowing the diffusion of hydrophobic molecules and small non-polar molecules. The image shows the features as:- Select the incorrect components:", "options": [{"label": "A", "text": "Endothelial cells", "correct": false}, {"label": "B", "text": "Fibrous astrocytes", "correct": false}, {"label": "C", "text": "Protoplasmic astrocytes", "correct": false}, {"label": "D", "text": "None of them", "correct": true}], "correct_answer": "D. None of them", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683532198426-QTDY012005IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>None of them Fibrous astrocytes are found primarily in white matter and contain many intermediate filaments; protoplasmic astrocytes are found in gray matter and have a granular cytoplasm. Protoplasmic astrocyte Fibrous astroctye cytoplasmic processes are short, numerous, more branch and thick Cytoplasmic processes are long, few, smooth, thin and less branch.</p>\n<p><strong>Highyeild:</strong></p><p>Both types of astrocytes send processes to blood vessels, where they induce capillaries to form the tight junctions making up the blood-brain barrier. They also send processes that envelop synapses and the surface of nerve cells. The blood–brain barrier (BBB) is a highly selective semipermeable border of endothelial cells that prevents solutes in the circulating blood from non-selectively crossing into the extracellular fluid of the central nervous system where neurons reside. Astrocytes and human artificial blood-brain barrier models:- The blood-brain barrier (BBB) functions as a highly selective border of endothelial cells, protecting the central nervous system from potentially harmful substances by selectively controlling the entry of cells and molecules, including components of the immune system.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- All options are correct</p>\n<p><strong>Extraedge:</strong></p><p>The Role of Astrocytes in different Conditions:-</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "CSF pressure depends primarily upon:", "options": [{"label": "A", "text": "Rate of formation from choroid plexus", "correct": false}, {"label": "B", "text": "Rate of absorption", "correct": true}, {"label": "C", "text": "Cerebral blood flow", "correct": false}, {"label": "D", "text": "Blood pressure", "correct": false}], "correct_answer": "B. Rate of absorption", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Rate of absorption Regulation of Cerebrospinal Fluid Pressure is by the Arachnoid Villi. CSF is made by choroid plexuses located in the lateral, third, and fourth ventricles. Travels to subarachnoid space via foramina of Luschka and Magendie, and is reabsorbed by arachnoid granulations, and then drains into dural venous sinuses.</p>\n<p><strong>Highyeild:</strong></p><p>The normal rate of cerebrospinal fluid formation remains nearly constant, so changes in fluid formation are seldom a factor in pressure control. Conversely, the arachnoid villi function like “valves” that allow cerebrospinal fluid and its contents to flow readily into the blood of the venous sinuses while not allowing blood to flow backward in the opposite direction. Normally, this valve action of the villi allows cerebrospinal fluid to begin to flow into the blood when cerebrospinal fluid pressure is about 1.5 mm Hg greater than the pressure of the blood in the venous sinuses. Then, if the cerebrospinal fluid pressure rises still higher, the valves open more widely. Under normal conditions, the cerebrospinal fluid pressure almost never rises more than a few millimeters of mercury higher than the pressure in the cerebral venous sinuses.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest options are incorrect because the regulation of Cerebrospinal Fluid Pressure is by the Rate of absorption in arachnoid villi.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "With CSF all are true except:", "options": [{"label": "A", "text": "Persistent leakage causes headache", "correct": false}, {"label": "B", "text": "Neutrophils are normally not present", "correct": false}, {"label": "C", "text": "pH is less than that of blood", "correct": false}, {"label": "D", "text": "Secreted by the arachnoid villi", "correct": true}], "correct_answer": "D. Secreted by the arachnoid villi", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Secreted by the arachnoid villi CSF is secreted by the choroid plexus, then passes through the pathway of CSF circulation and finally gets absorbed by the Arachnoid villi.</p>\n<p><strong>Highyeild:</strong></p><p>CSF is made by choroid plexuses located in the lateral, third, and fourth ventricles. Travels to subarachnoid space via foramina of Luschka and Magendie, and is reabsorbed by arachnoid granulations, and then drains into dural venous sinuses. Cerebrospinal fluid is formed at a rate of about 500 milliliters each day, which is three to four times as much as the total volume of fluid in the entire cerebrospinal fluid system. About two-thirds or more of this fluid originates as secretion from the choroid plexuses in the four ventricles, mainly in the two lateral ventricles. Additional small amounts of fluid are secreted by the ependymal surfaces of all the ventricles and by the arachnoidal membranes. A small amount comes from the brain through the perivascular spaces that surround the blood vessels passing through the brain.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Persistent headache: Following the trauma of the midface, CSF may emanate from a dural tear, resulting in rhinorrhea, otorrhea, or both. Usually painless. • Leakage is typically noted immediately following trauma but may occasionally be noted days to weeks after the traumatic event. The secretion should be collected in a vial: an absence of sediment and a glucose level of approximately 45 mg/dL is usually confirmatory. A more specific laboratory examination is the CSF-specific beta-2 transferrin test CSF will also form concentric rings (target sign) when poured on linen or soft filter paper. Once a provisional diagnosis is made, the patient should be placed in a semirecumbent position and instructed on how to minimize increases in intracranial pressure, including straining, sneezing, and blowing of the nose. Option: B. Neutrophils are normally not present: Normally <5 lymphocytes are present per cubic mm out of which 60-70% are lymphocytes and <30% are monocytes/macrophages . Option: C. pH is less than that of blood: pH of blood and CS are almost equal. .</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Degeneration of corpus striatum cause:", "options": [{"label": "A", "text": "Parkinson’s disease", "correct": false}, {"label": "B", "text": "Chorea", "correct": true}, {"label": "C", "text": "Hemiballismus", "correct": false}, {"label": "D", "text": "Athetosis", "correct": false}], "correct_answer": "B. Chorea", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Chorea The initial detectable damage in Huntington Chorea is to medium spiny neurons in the striatum. Striatum refers to the Neostriatum. The corpus striatum includes the striatum (neostriatum) and pallidum.</p>\n<p><strong>Highyeild:</strong></p><p>The (neo)striatum includes the caudate nucleus, putamen, and nucleus accumbens The pallidum includes the globus pallidus (paleostriatum). Loss of medium spiny neurons in the striatum leads to loss of GABAergic pathway to the globus pallidus external segment releases inhibition, permitting the hyperkinetic features of the disease to develop. An early sign is a jerky trajectory of the hand when reaching to touch a spot, especially toward the end of the reach. Later, hyperkinetic choreiform movements appear and gradually increase until they incapacitate the patient. Speech becomes slurred and then incomprehensible, and progressive dementia is followed by death, usually within 10–15 years after the onset of symptoms.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Parkinson's primarily affects neurons in an area of the brain called the substantia nigra. Option: C. Hemiballismus is usually caused by a stroke that affects a small area just below the basal ganglia called the subthalamic nucleus. The subthalamic nucleus helps control voluntary movements. Option: D. Athetosis occurs when there has been damage to the corpus striatum (caudate and putamen) in the basal ganglia, most often in children with perinatal ischemia and hypoxia or severe bilirubin toxicity.</p>\n<p><strong>Extraedge:</strong></p><p>Huntington’s disease (HD) is an autosomal dominant disorder, presenting in adults usually but occasionally in children. It is due to the expansion of a trinucleotide CAG repeat in the Huntingtin gene on chromosome 4. The disease frequently demonstrates the phenomenon of anticipation, in which there is a younger age at onset as the disease is passed through generations, due to progressive expansion of the repeat. Clinical features: typically presents with a progressive behavioral disturbance, abnormal movements (usually chorea), and cognitive impairment leading to dementia. Onset under 18 years is rare but patients may then present with parkinsonism rather than chorea (the ‘Westphal variant’). OTHER SIGNS USEFUL FOR LOCALIZING: Putamen: Dystonia Subthalamic nucleus: Ballism. Substantia nigra: Resting tremors; Parkinsonism. Damaging the cerebellum causes uncoordinated movements (dysmetria, ataxia, intention tremor, overshooting/post pointing; slowness of movement Chorea: Caudate nucleus (Caudate nucleus atrophy occurs in Huntington’s disease) Athetosis: Globus pallidus</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Ablation of the ‘somatosensory area 1’ of the cerebral cortex leads to:", "options": [{"label": "A", "text": "Total loss of pain sensation", "correct": false}, {"label": "B", "text": "Total loss of touch sensation", "correct": false}, {"label": "C", "text": "Loss of tactile localization but not of two point discrimination", "correct": false}, {"label": "D", "text": "Loss of tactile localization and two point discrimination", "correct": true}], "correct_answer": "D. Loss of tactile localization and two point discrimination", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Loss of tactile localization and two point discrimination Effect of Removing the Somatosensory Association Area— Amorphosynthesis.</p>\n<p><strong>Highyeild:</strong></p><p>When the somatosensory association area is removed on one side of the brain, the person loses the ability to recognize complex objects and addition, he or she loses most of the sense of form of his or her own body or body parts on the opposite side. In fact, the person is mainly oblivious to the opposite side of the body—that is, forgets that it is there. Therefore, the person also often forgets to use the other side for motor functions as well. Likewise, when feeling objects, the person tends to recognize only one side of the object and forgets that the other side even exists.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Pain related brain regions. Key brain regions related to somatosensory (blue), affective (green), and cognitive (orange) pain processing. Option: B. The area of the brain responsible for interpreting the sense of touch is called the sensory cortex. Option: C. The somatosensory cortex receives tactile information from the body, including sensations such as touch, pressure, temperature, and pain.</p>\n<p><strong>Extraedge:</strong></p><p>Area (S1) receives projection fibers from the thalamus, whereas the neuronal connections of area (S2) are not well understood. The arterial blood is supplied to the somatosensory cortex by the medial and anterior cerebral arteries. Different functions performed by the somatosensory cortex include the following: Crude localization of senses Perception of degree of pressure and other sensations Judgment of weight of objects Perception of shapes of different objects Feeling the texture of objects Bilateral lesions of the somatosensory cortex cause decline in above-mentioned functions. Unilateral lesions cause defective localization of sensations on the contralateral side of the body.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The most common neuron in Cerebral cortex is:", "options": [{"label": "A", "text": "Stellate cells", "correct": false}, {"label": "B", "text": "Pyramidal cells", "correct": true}, {"label": "C", "text": "Granular cells", "correct": false}, {"label": "D", "text": "Basket cells", "correct": false}], "correct_answer": "B. Pyramidal cells", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Pyramidal cells Most of the neurons in the cerebral cortex are arranged vertically and most abundant neurons are the different pyramidal cells (very large giant pyramidal cells found in the layer V of the regions of the motor cortex are called Betz cells).</p>\n<p><strong>Highyeild:</strong></p><p>The neocortex is generally arranged in six layers. Molecular (plexiform) layer. External granular layer. External pyramidal layer. Internal granular layer. Internal pyramidal layer. Multiform (fusiform) layer. The most common neuronal type is the pyramidal cell with an extensive vertical dendritic tree that may reach to the cortical surface. Their cell bodies can be found in all cortical layers except layer I. The axons of these cells usually give recurrent collaterals that turn back and synapse on the superficial portions of the dendritic trees. Layer I - This layer is called the molecular layer. As you can see from the diagram, it has very few neurons and cells. Instead, it is mainly composed of dendrites and axons that extend from lower levels of the neocortex. Layer II- Because this is one of the outer layers, and it is composed of granule cells, scientists named it the external granule layer. Function- Receives inputs from other areas of the neocortex. Layer III- This is the external pyramidal cell layer. Pyramidal cells make up this layer; they are called \"pyramidal\" because their somas are triangular shaped. Function- Receives input from other cortical regions and outputs to other cortical columns. Layer IV- Located deeper within the neocortex, and composed of granule cells, this layer is thus called the internal granule layer. Function- Granule cells in this layer receive sensory input and relay it to adjacent neocortex columns. Layer IV is very thick in the primary sensory cortex (i.e. the primary visual cortex). Layer V- Another layer of pyramidal cells makes up the neocortex. The cells in this internal pyramidal cell layer are larger than those in Layer III. Function- Layer V is involved heavily in making motor movements. Layer VI- Many different types of cells make up this layer. Its structure isn't very homogenous, so it was called the multiform layer. Function- Receiving and integrating information from the brainstem and outputs to the thalamus.</p>\n<p><strong>Random:</strong></p><p>Explanation for incorrect Options:- Option: A. Stellate cells (SCs) are inhibitory GABAergic interneurons that make-up neuronal circuits that control the output from the cerebellar cortex by regulating the firing properties of Purkinje cells. Option: C. Granule cells in the dorsal cochlear nucleus play a role in the perception and response to sounds in our environment. Option: D. Basket cells are inhibitory interneurons in the cerebellar cortex that innervate Purkinje cells with a unique terminal called the pinceau.</p>\n<p><strong>Extraedge:</strong></p><p>The neocortex is arranged in six layers. Afferents from the specific nuclei of the thalamus terminate primarily in layer IV; the nonspecific nuclei project to layers I to IV. Pyramidal neurons, the most common cell type in the cortex, have extensive vertical dendritic trees that reach toward the cortical surface. Their cell bodies are found in all cortical layers except layer I. Pyramidal neurons are excitatory neurons that release glutamate at their terminals, and they are the only projection neurons of the cortex. The other cortical cell types are local circuit interneurons and are classified based on their shape, pattern of projection, and neurotransmitter. Inhibitory interneurons (basket cells and chandelier cells) release GABA as their neurotransmitter. Basket cells have long axonal endings that surround the soma of pyramidal neurons, they account for most inhibitory synapses on the pyramidal soma and dendrites. Chandelier cells are a powerful source of inhibition of pyramidal neurons because their axonal endings terminate exclusively on the initial segment of the pyramidal cell axon. Their terminal boutons form short vertical rows that resemble candlesticks, thus accounting for their name. Spiny stellate cells are excitatory neurons that release glutamate; these multipolar interneurons are located primarily in layer IV and are a major recipient of sensory information arising from the thalamus. In addition to being organized into layers, the cerebral cortex is also organized into columns. Neurons within a column have similar response properties, suggesting they comprise a local processing network (g., orientation and ocular dominance columns in the visual cortex).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Pain insensitive structure in brain is:", "options": [{"label": "A", "text": "Falx cerebri", "correct": false}, {"label": "B", "text": "Dural venous sinuses", "correct": false}, {"label": "C", "text": "Choroid plexus", "correct": true}, {"label": "D", "text": "Middle meningeal A", "correct": false}], "correct_answer": "C. Choroid plexus", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Choroid plexus The cranium, brain parenchyma, ependymal lining of the ventricles, and choroid plexus are all pain insensitive.</p>\n<p><strong>Highyeild:</strong></p><p>Tugging on the venous sinuses around the brain, damaging the tentorium, or stretching the dura at the base of the brain can cause intense pain that is recognized as headache. Also, almost any type of traumatizing, crushing, or stretching stimulus to the blood vessels of the meninges can cause headache. An especially sensitive structure is the middle meningeal artery, and neurosurgeons are careful to anesthetize this artery specifically when performing brain operations with use of local anesthesia.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Options: A and B . Falx cerebri and Dural venous sinuses are modifications of dura mater. Therefore, these are pain sensitive. Option: D. The middle meningeal artery is covered by meninges that cause pain on stimulus.The only meningeal layer sensitive to pain is the durometer .</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Destruction of sensory area 1 of the brain leads to loss of which sensations?", "options": [{"label": "A", "text": "Pain", "correct": false}, {"label": "B", "text": "Touch", "correct": false}, {"label": "C", "text": "Tactical sensation", "correct": false}, {"label": "D", "text": "Stereognosis & 2 point discrimination", "correct": true}], "correct_answer": "D. Stereognosis & 2 point discrimination", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Stereognosis & 2 point discrimination Destruction of sensory area 1 of the brain leads to loss of Stereognosis & 2 point discrimination. Stereognosis = ability to identify objects when placed in each hand with the eyes closed. Paperclip, coin, button, etc. Two-point discrimination = ability to tell the difference between one point and two points 4 mm apart on the tips of the fingers.</p>\n<p><strong>Highyeild:</strong></p><p>Widespread bilateral excision of somatosensory area I causes loss of the following types of sensory judgment: The person is unable to localize the different sensations in the different parts of the body. However, he or she can localize these sensations crudely, such as to a particular hand, to a major level of the body trunk, or to one of the legs. Thus, it is clear that the brain stem, thalamus, or parts of the cerebral cortex not normally considered to be concerned with somatic sensations can perform some degree of localization. The person is unable to judge critical degrees of pressure against the body. The person is unable to judge the weights of objects. The person is unable to judge shapes or forms of objects. This condition is called astereognosis. The person is unable to judge the texture of materials because this type of judgment depends on highly critical sensations caused by movement of the fingers over the surface to be judged.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Pain related brain regions. Key brain regions related to somatosensory (blue), affective (green), and cognitive (orange) pain processing. Option: B. The area of the brain responsible for interpreting the sense of touch is called the sensory cortex. Option: C. The somatosensory cortex receives tactile information from the body, including sensations such as touch, pressure, temperature, and pain.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A patient complains that at the bare mention of the tragic events that once occurred in his life, he experiences tachycardia, dyspnea and an abrupt rise in blood pressure. What structures of the CNS are responsible for these cardiorespiratory reactions in this patient?", "options": [{"label": "A", "text": "Specific thalamic nuclei", "correct": false}, {"label": "B", "text": "Lateral hypothalamic nuclei", "correct": false}, {"label": "C", "text": "Cerebellum", "correct": false}, {"label": "D", "text": "Cerebral cortex", "correct": true}], "correct_answer": "D. Cerebral cortex", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Cerebral cortex If there is no direct stimulation of specific receptors, only emotions or memory are involved in the appearance of a reflex (like fear during exam or remembering of tragic events), then that reflex is conditioned. Tachycardia and increase of BP are sympathetic responses. The department of the brain responsible for conditioned reflexes establishment and execution is always the cerebral cortex.</p>\n<p><strong>Random:</strong></p><p>Explanation for incorrect Options:- Option: A. Specific thalamic nuclei; first, the specific thalamic nuclei relay sensory and motor messages that may become the contents of consciousness, and second, the nonspecific nuclei are likely involved in the control of cortical arousal originating from the brainstem reticular formation. Option: B. LH neurons control feeding, blood pressure, heart rate, water intake and sodium excretion largely through the activation of adrenergic receptors. Option: C. Cerebellum is part of the brain that helps coordinate and regulate a wide range of functions and processes in both brain and body.</p>\n<p><strong>Extraedge:</strong></p><p>Cerebral Cortex Regions</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 23 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A neurologist met with a male person of age 23 years who had the high capability to retain information about the phone numbers which were revised several times in an event. The person was able to interpret the phone number easily. Neurologists concluded that a person has Good capability of which type of memory?", "options": [{"label": "A", "text": "Long-term memory", "correct": false}, {"label": "B", "text": "Working memory", "correct": false}, {"label": "C", "text": "Short-term memory", "correct": true}, {"label": "D", "text": "All incorrect", "correct": false}], "correct_answer": "C. Short-term memory", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Short-term memory Short-term memory also called primary or active memory is the capacity for holding, but not manipulating, a small amount of information in mind in an active, readily available state for a short period. For example, short-term memory can be used to remember a phone number that has just been recited. The duration of short-term memory (when rehearsal or active maintenance is prevented) is believed to be in the order of seconds.</p>\n<p><strong>Highyeild:</strong></p><p>Short-term memory should be distinguished from working memory, which refers to structures and processes used for temporarily storing and manipulating information</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Long-term memory - It refers to the storage of information over an extended period. This type of memory tends to be stable and can last a long time often for years. Option: B. Working memory is the small amount of information that can be held in mind and used in the execution of cognitive tasks, in contrast with long-term memory, the vast amount of information saved in one's life. Working memory is one of the most widely-used terms in psychology</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Neurologists studied the role of Memory traces in all parts of the brain and concluded the presence of memory traces in the spinal cord. Select the incorrect memory traces:", "options": [{"label": "A", "text": "Theoretical means by which memories are physically stored in the brain.", "correct": false}, {"label": "B", "text": "Memory traces can be selectively activated by the thinking mind to reproduce the memories.", "correct": false}, {"label": "C", "text": "Most memories with intellectual processes are based on memory traces in the cerebral cortex.", "correct": false}, {"label": "D", "text": "Most memories in the brain are associated with the cerebellum.", "correct": true}], "correct_answer": "D. Most memories in the brain are associated with the cerebellum.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Most memories in the brain are associated with the cerebellum. Most memories with intellectual processes are based on memory traces in the cerebral cortex.</p>\n<p><strong>Highyeild:</strong></p><p>An engram is a unit of cognitive information imprinted in a physical substance, theorized to be how memories are stored as biophysical or biochemical changes in the brain or other biological tissue, in response to external stimuli. The term \"engram\" was coined by memory researcher Richard Semon in reference to the physical substrate of memory in the organism. Neuroscience acknowledges the existence of many types of memory and their physical location within the brain is likely to be dependent on the respective system mediating the encoding of this memory. Memories are stored in the brain by changing the basic sensitivity of synaptic transmission between neurons as a result of previous neural activity. The new or facilitated pathways are called memory traces. They are important because once the traces are established, they can be selectively activated by the thinking mind to reproduce the memories.</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option: A. Theoretical means by which memories are physically stored in the brain are memory traces. Option: B. Memory traces can be selectively activated by the thinking mind to reproduce the memories . Option: C. Most memories with intellectual processes are based on memory traces in the cerebral cortex.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 67-year-old male was taken to the hospital with manifestations of impaired thinking, impaired behavior, muscle rigidity, impaired movement of hands, and mood changes over the past several months. Examination revealed the presence of abnormal deposits of a protein called alpha-synuclein in the brain. Some facial expressions in the image signify the manifestations. The patient was diagnosed with Parkinson's disease. Select the incorrect:", "options": [{"label": "A", "text": "Impaired ability to hit and see a tennis ball.", "correct": false}, {"label": "B", "text": "Impaired ability to perceive the relationship and speed of the ball to the racquet", "correct": false}, {"label": "C", "text": "Impaired ability to deduce rapidly the motions of the body, the arms, and the racquet required to hit the ball as desired", "correct": false}, {"label": "D", "text": "Declarative memory", "correct": true}], "correct_answer": "D. Declarative memory", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Declarative memory Skill memory is affected in persons with Lewy body dementia, and Parkinson's disease. Declarative memory or explicit memory is devoted to the processing of names, dates, places, facts, events, and so forth. These are entities that are thought of as being encoded symbolically and that thus can be described with language. In terms of function, declarative memory is specialized for fast processing and learning.</p>\n<p><strong>Highyeild:</strong></p><p>Procedural memory, also called implicit memory, is a type of long-term memory involved in the performance of different actions and skills. Essentially, it is the memory of how to do certain things. Riding a bike, tying your shoes, and cooking an omelet without a recipe are all examples of procedural memories.</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option: A. Impaired ability to hit and see a tennis ball is a skill memory deficit. Option: B. Impaired ability to perceive the relationship and speed of the ball to the racquet is a skill memory deficit. Option: C. Impaired ability to deduce rapidly the motions of the body, the arms and the racquet required to hit the ball as desired is called skill memory deficit.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Neurologists studied that sensations like pain or pleasure, the brain has a different automatic capability of enhancing and storing memory traces. In this way, the brain is capable of processing positive and negative memories in one’s life. Select the Correct Option:", "options": [{"label": "A", "text": "The brain has the capability to avoid information of no value by inhibiting the synaptic pathways.", "correct": false}, {"label": "B", "text": "Habituation is a type of negative memory.", "correct": false}, {"label": "C", "text": "Positive memory by facilitation of the synaptic pathways.", "correct": false}, {"label": "D", "text": "All of them", "correct": true}], "correct_answer": "D. All of them", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>All of them Positive memory is stored by the facilitation of the synaptic pathways. The brain is inundated with sensory information from all our senses. If our minds attempted to remember all this information, the memory capacity of the brain would be rapidly exceeded. Fortunately, the brain has the capability to ignore information that is of no consequence. This capability results from the inhibition of the synaptic pathways for this type of information; the resulting effect is called habituation, which is a type of negative memory.</p>\n<p><strong>Highyeild:</strong></p><p>Conversely, for incoming information that causes important consequences such as pain or pleasure, the brain has a different automatic capability of enhancing and storing the memory traces, which is a positive memory. It results from the facilitation of the synaptic pathways, and the process is called memory sensitization.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Brain has the capability to avoid information of no value by inhibiting the synaptic pathways. Option: B. Habituation is a type of negative memory. The brain has the capability to ignore information that is of no consequence. This capability results from the inhibition of the synaptic pathways for this type of information; the resulting effect is called habituation, which is a type of negative memory. Option: C. Positive memory by facilitation of the synaptic pathways.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A patient at the age of 23 years reported to the psychiatrist about the habit of washing his hands repeatedly. The psychiatrist did counseling of the patient by addressing that it is an abnormal habituation that can be dropped by counseling and medication. You should not panic about it. Select the incorrect mechanism of habituation:", "options": [{"label": "A", "text": "Progressive closure of calcium channels through the terminal membrane leads to a habituation effect in the sensory terminal.", "correct": false}, {"label": "B", "text": "Habituation is a negative memory.", "correct": false}, {"label": "C", "text": "Habituation is skill memory.", "correct": false}, {"label": "D", "text": "Correct A and B", "correct": true}], "correct_answer": "D. Correct A and B", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Correct A and B Option A. Progressive closure of calcium channels through the terminal membrane leads to a habituation effect in the sensory terminal. Option B. Habituation is a negative memory- At the molecular level, the habituation effect in the sensory terminal results from the progressive closure of calcium channels through the terminal membrane, although the cause of this calcium channel closure is not fully known. Nevertheless, much smaller than normal amounts of calcium ions can diffuse into the habituated terminal, and much less sensory terminal transmitter is therefore released because calcium entry is the principal stimulus for transmitter release.</p>\n<p><strong>Highyeild:</strong></p><p>The brain has the capability to learn to ignore information that is of no consequence. This results from the inhibition of the synaptic pathways for this type of information; the resulting effect is called This is a type of negative memory. Conversely, for incoming information that causes important consequences such as pain or pleasure, the brain has a different automatic capability of enhancing and storing memory This is a positive memory . It results from the facilitation of the synaptic pathways, and the process is called memory sensitization .</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Option:- Option: C. Habituation is not skill memory. Skill memory, also known as procedural memory, is in charge of knowing how to do things. When we ride a bike, drive a car, hold a pencil, or play.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "In a class of research scholars of neurology, the neurologist was teaching the basics of neural Facilitation. He explained the role of calcium ions in the neural facilitation process. Select the incorrect option:", "options": [{"label": "A", "text": "Serotonin is released at the facilitator synapse on the surface of the sensory terminal.", "correct": false}, {"label": "B", "text": "Adenyl cyclase causes the formation of cyclic adenosine monophosphate inside the sensory presynaptic terminal.", "correct": false}, {"label": "C", "text": "cAMP activates a protein kinase and blocks potassium channels causing a prolonged action potential.", "correct": false}, {"label": "D", "text": "Prolonged action potential suppresses calcium channels for a long period.", "correct": true}], "correct_answer": "D. Prolonged action potential suppresses calcium channels for a long period.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Prolonged action potential suppresses calcium channels for a long period. The prolonged action potential does not suppress calcium channels for a long period but activates calcium channels.</p>\n<p><strong>Highyeild:</strong></p><p>Stimulation of the facilitator presynaptic terminal at the same time that the sensory terminal is stimulated causes serotonin release at the facilitator synapse on the surface of the sensory terminal. The serotonin acts on serotonin receptors in the sensory terminal membrane, and these receptors activate the enzyme adenylyl cyclase inside the membrane. The adenyl cyclase then causes the formation of cyclic adenosine monophosphate (cAMP), also inside the sensory presynaptic terminal. The cAMP activates a protein kinase that causes phosphorylation of a protein that is part of the potassium channels in the sensory synaptic terminal membrane; this in turn blocks the channels for potassium conductance. The blockage can last for minutes up to several weeks.</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option: A. Serotonin is released at the facilitator synapse on the surface of the sensory terminal. Option: B. Adenyl cyclase causes the formation of cyclic adenosine monophosphate inside the sensory presynaptic terminal. Option: C. cAMP activates a protein kinase and blocks potassium channels causing a prolonged action potential</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A patient at age 56 years visited the physician with manifestations of difficulty falling asleep at night, tiredness in the morning, and ill feeling of depression state from the past 6 months. The patient was diagnosed with insomnia. Select the incorrect memory:", "options": [{"label": "A", "text": "A time-dependent process by which recently learned experiences are transformed into long-term memory.", "correct": false}, {"label": "B", "text": "Insomnia causes failure of consolidation of memory.", "correct": false}, {"label": "C", "text": "Deep general anesthesia can temporarily block the consolidation of memory.", "correct": false}, {"label": "D", "text": "All of them are incorrect", "correct": true}], "correct_answer": "D. All of them are incorrect", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>All of them are incorrect Memory consolidation is a category of processes that stabilize a memory trace after its initial acquisition.</p>\n<p><strong>Highyeild:</strong></p><p>A memory trace is a change in the nervous system caused by memorizing something. Consolidation is distinguished into two specific processes. The first, synaptic consolidation, which is thought to correspond to late-phase long-term potentiation, occurs on a small scale in the synaptic connections and neural circuits within the first few hours after learning. The second process is systems consolidation, occurring on a much larger scale in the brain, rendering hippocampus-dependent memories independent of the hippocampus over a period of weeks to years. Recently, a third process has become the focus of research, reconsolidation, in which previously consolidated memories can be made labile again through reactivation of the memory trace.</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- All options are correct:- Option: A. Time-dependent process by which recently learned experiences are transformed into long-term memory. Option: B. Insomnia causes failure of consolidation of memory. Option: C. Deep general anesthesia can temporarily block the consolidation of memory.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A patient at the age of 59 years came to the physician with an inability to remember the house number, name of the street, and names of his friend whom he met recently. He gave H/O surgical removal of both hippocampi for epilepsy treatment. The patient was diagnosed with anterograde amnesia. Select the incorrect:", "options": [{"label": "A", "text": "Absence of capability for storing verbal and symbolic types of declarative memory.", "correct": false}, {"label": "B", "text": "No capability to retain skill memory.", "correct": true}, {"label": "C", "text": "Hippocampus is involved in the “reward” and “punishment” areas of the limbic system.", "correct": false}, {"label": "D", "text": "“Reward” and “punishment” together provide the background mood and motivations for all persons.", "correct": false}], "correct_answer": "B. No capability to retain skill memory.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>No capability to retain skill memory. Skill memory is procedural memory, also called implicit memory, and is a type of long-term memory involved in the performance of different actions and skills. Essentially, it is the memory of how to do certain things. Riding a bike, tying shoes, and cooking without a recipe are all examples of procedural memories.</p>\n<p><strong>Highyeild:</strong></p><p>Anterograde amnesia is a loss of the ability to create new memories after the event that caused amnesia, leading to a partial or complete inability to recall the recent past, while long-term memories from before the event remain intact. This is in contrast to retrograde amnesia, where memories created before the event are lost while new memories can still be created. Both can occur together in the same patient. To a large degree, anterograde amnesia remains a mysterious ailment because the precise mechanism of storing memories is not yet well understood, although it is known that the regions involved are certain sites in the temporal cortex, especially in the hippocampus and nearby subcortical regions</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option: A. Absence of capability for storing of verbal and symbolic types declarative memory in anterograde amnesia. Option: C. Hippocampus is involved in the “reward” and “punishment” areas of the limbic system. Option: D. Persistent “reward” or “punishment\" together provide the background mood and motivations for all persons.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The memory formation process in the CNS involves all except:", "options": [{"label": "A", "text": "It involves a change in neurotransmitter release at the synapse.", "correct": false}, {"label": "B", "text": "Increase in no. of synapses and dendrites.", "correct": false}, {"label": "C", "text": "Recruitment of neurons and involvement of more neurons in a particular function as in the somatosensory area of the cortex.", "correct": false}, {"label": "D", "text": "Allocation of specialized nerve cells occurs in the hippocampus.", "correct": true}], "correct_answer": "D. Allocation of specialized nerve cells occurs in the hippocampus.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Allocation of specialized nerve cells occurs in the hippocampus. Allocation of specialized nerve cells doesn't occur in the hippocampus. Being an integral part of the limbic system, the hippocampus plays a vital role in regulating learning, memory encoding, memory consolidation, and spatial navigation.</p>\n<p><strong>Highyeild:</strong></p><p>It appears that the development of true long-term memory depends on physically restructuring the synapses themselves in a way that changes their sensitivity for transmitting nerve The following important structural changes occur: An increase in vesicle release sites for secretion of transmitter substance. An increase in the number of transmitter vesicles released. An increase in the number of presynaptic Terminals. Changes in the structures of the dendritic spines permit the transmission of stronger signals Thus, in several different ways, the structural capability of synapses to transmit signals appears to increase during the establishment of true long-term memory traces.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- The memory formation process in the CNS involves Option: A. It involves a change in neurotransmitter release at the synapse. Option: B. Increase in the number of synapses and dendrites. Option: C. Recruitment of neurons and involvement of more neurons in a particular function as in the somatosensory area of the cortex.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following is excitatory?", "options": [{"label": "A", "text": "Gamma-amino-butyric acid", "correct": false}, {"label": "B", "text": "Glycine", "correct": false}, {"label": "C", "text": "Glutamate", "correct": true}, {"label": "D", "text": "Lysine", "correct": false}], "correct_answer": "C. Glutamate", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Glutamate The amino acid glutamate is the main excitatory neurotransmitter in the brain and spinal cord and may be responsible for 75% of the excitatory transmission in the CNS .</p>\n<p><strong>Highyeild:</strong></p><p>There are two distinct pathways involved in the synthesis of glutamate. Glutamate acts on both ionotropic and metabotropic receptors in the CNS. There are three subtypes of ionotropic glutamate receptors, each named for its relatively specific agonist. These are the AMPA, kainate, and NMDA receptors.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A . Gamma-amino-butyric acid: GABA is the major inhibitory mediator in the brain and mediates both presynaptic and postsynaptic inhibition . The increase in Cl– conductance produced by GABAA receptors is potentiated by benzodiazepines (eg, diazepam). These drugs have marked antianxiety activity and are also effective muscle relaxants, anticonvulsants, and sedatives. Benzodiazepines bind to α subunits of GABAA receptors. Barbiturates such as phenobarbital are effective anticonvulsants because they enhance GABAA receptor-mediated inhibition and suppress AMPA receptor-mediated excitation. Option: B . Glycine has both excitatory and inhibitory effects in the CNS. When it binds to NMDA receptors, it makes them more sensitive to the actions of glutamate. Glycine may spill over from synaptic junctions into the interstitial fluid and in the spinal cord; for example, it may facilitate pain transmission by NMDA receptors in the dorsal horn. However, glycine mediates direct inhibition in the brainstem and spinal cord. The glycine receptor that mediates inhibition is a Cl– channel, a pentamer made up of two subunits: the ligand-binding α subunit and the structural β subunit. Option: D . Lysine: It is an amino acid.</p>\n<p><strong>Extraedge:</strong></p><p>Excessive levels of glutamate occur in response to ischemia, anoxia, hypoglycemia, or trauma. Glutamate and some of its synthetic agonists are unique in that when they act on neuronal cell bodies, they can produce so much Ca2+ influx that the neurons die. Excitotoxins play a significant role in the damage done to the brain by a stroke. When a cerebral artery is occluded, the cells in the severely ischemic area die. The surrounding partially ischemic cells may survive but lose their ability to maintain the transmembrane Na+ gradient. The elevated levels of intracellular Na+ prevent the ability of astrocytes to remove glutamate from the brain’s extracellular fluid. Therefore, glutamate accumulates to the point that excitotoxic damage and cell death occur in the penumbra, the region around the completely infarcted area. In addition, excessive glutamate receptor activation may contribute to the pathophysiology of some neurodegenerative diseases such as amyotrophic lateral sclerosis (ALS), Parkinson's disease, and Alzheimer's Riluzole is a voltage-gated channel blocker that may antagonize N-methyl-D-aspartate (NMDA) receptors. It slows the progression of impairment and modestly improves the life expectancy of patients with ALS. Memantine, another NMDA receptor antagonist, has been used to slow the progressive decline in patients with Alzheimer's Amantadine, another NMDA receptor antagonist, in conjunction with levodopa, improves function in patients with Parkinson's</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 20 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A 72-year-old man visits his physician because he finds it difficult to hold his hand steady when painting. Examination reveals a resting tremor and rigidity. The symptoms are relieved by a single dose of levodopa, suggestive of Parkinson’s disease. This patient’s neurological signs are most likely related to a lesion within which of the following?", "options": [{"label": "A", "text": "The cerebellum", "correct": false}, {"label": "B", "text": "The substantia nigra", "correct": true}, {"label": "C", "text": "The premotor area", "correct": false}, {"label": "D", "text": "The caudate nucleus and putamen", "correct": false}], "correct_answer": "B. The substantia nigra", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The substantia nigra Direct question: Parkinson’s Disease is caused by the destruction of the dopamine-secreting neurons within the substantia nigra of the basal ganglia.</p>\n<p><strong>Highyeild:</strong></p><p>Environmental or genetic factors alter the α-synuclein protein, rendering it toxic and leading to Lewy body formation within the nigral cells (Substantia nigra) in basal ganglia. Nerve cells in this part of the brain are responsible for producing a chemical called dopamine.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest options are not correct because Parkinson's disease is caused by a loss of nerve cells in the part of the brain called the substantia nigra.</p>\n<p><strong>Extraedge:</strong></p><p>Loss of substantia nigra (SN) neurons causes Parkinson's disease. Pathological examination of a healthy patient (A) reveals typical pigmented DA neurons in the SN (arrows); in contrast, loss of SN neurons leads to pigment disappearance in the PD brain (B, arrows). Magnification of the SN area reveals a dense network of melanin-pigmented SN neurons in the healthy brain (C) while most SN neurons are lost in PD (D). Some of the remaining neurons in PD contain insoluble cytoplasmic protein aggregates (Lewy Bodies, E) that are made of aggregated alpha-synuclein and other proteins. The melanin-containing granules have a red-brown hue and are distributed in the cytosol of all SN neurons (C-E). The picture in E is the higher magnification of the dark-boxed area in D.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 17-year-old boy is admitted to the hospital with a traumatic brain injury, sustained when he fell off his motorcycle. He develops a fever of 39°C, which is unrelated to an infection or inflammation. The fever is most likely due to a lesion of which of the following?", "options": [{"label": "A", "text": "The lateral hypothalamus", "correct": false}, {"label": "B", "text": "The arcuate nucleus", "correct": false}, {"label": "C", "text": "The posterior nucleus", "correct": false}, {"label": "D", "text": "The anterior hypothalamus", "correct": true}], "correct_answer": "D. The anterior hypothalamus", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The anterior hypothalamus The anterior hypothalamus regulates body temperature.</p>\n<p><strong>Highyeild:</strong></p><p>Core body temperature, the temperature of the deep tissues of the body, is detected by thermoreceptors located within the anterior hypothalamus. The anterior hypothalamus also contains neurons responsible for initiating reflexes, such as vasodilation and sweating, which are designed to reduce body temperature. Heat-producing reflexes, such as shivering, and heat-maintenance reflexes, such as vasoconstriction, are initiated by neurons located within the posterior hypothalamus. The paraventricular nucleus secretes oxytocin and vasopressin, The ventromedial and lateral nuclei control food</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. LH neurons control feeding, blood pressure, heart rate, water intake, and sodium excretion largely through the activation of adrenergic receptors Option: B. The arcuate nucleus secretes gonadotropin-releasing hormone. Option: C. The posterior nucleus (Po), a higher-order thalamic nucleus, is a key hub of this network, receiving cortical and brainstem sensory inputs and innervating both motor and sensory whisker-related cortical areas.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following statements is incorrectly related to the hypothalamus?", "options": [{"label": "A", "text": "A major part of the limbic system is the hypothalamus, with its related structures.", "correct": false}, {"label": "B", "text": "Control osmolality of the body fluids, and the drives to eat and drink.", "correct": false}, {"label": "C", "text": "Hypothalamus represents nearly 5% of the brain mass.", "correct": true}, {"label": "D", "text": "Large lateral hypothalamic area is present on each side of the hypothalamus.", "correct": false}], "correct_answer": "C. Hypothalamus represents nearly 5% of the brain mass.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Hypothalamus represents nearly 5% of the brain mass. Hypothalamus represents less than 1% of the brain mass and is the central element of the limbic system.</p>\n<p><strong>Highyeild:</strong></p><p>The anatomical structures of the limbic system demonstrate that they are an interconnected complex of basal brain elements. Located in the middle of all these structures is the extremely small hypothalamus, which from a physiological point of view is one of the central elements of the limbic system.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. A major part of the limbic system is the hypothalamus, with its related structures. Option: B. Hypothalamus controls the osmolality of the body fluids, and the drives to eat and drink. Option: D. Presence of a large lateral hypothalamic area is present on each side of the hypothalamus. A major part of the limbic system is the hypothalamus, with its related structures. In addition to their roles in behavioral control, these areas control many internal conditions of the body, such as body temperature, the osmolality of the body fluids, and the drives to eat and drink and to control body weight.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Hypothalamus is a portion of the brain that contains a number of small nuclei. Hypothalamus links the nervous system to the endocrine system via the pituitary gland. An area marked in the red circle in the image located in the anterior portion of the hypothalamus has specific functions. Select the correct statements:-", "options": [{"label": "A", "text": "Contains large numbers of heat-sensitive neurons and 1/3rd of cold-sensitive neurons.", "correct": false}, {"label": "B", "text": "Heat-sensitive neurons increase their firing rate 20 times in response to a 10°-C increase in body temperature.", "correct": false}, {"label": "C", "text": "Hypothalamic-preoptic area has the capability to serve as a thermostatic body temperature control center.", "correct": false}, {"label": "D", "text": "Only A and C correct", "correct": true}], "correct_answer": "D. Only A and C correct", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683532282500-QTDY015004IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Only A and C correct Option A. Preoptic area contains large numbers of heat-sensitive neurons and 1/3rd of cold-sensitive Option C. The hypothalamic-preoptic area has the capability to serve as a thermostatic body temperature control center.</p>\n<p><strong>Highyeild:</strong></p><p>The anterior hypothalamic-preoptic area contains large numbers of heat-sensitive neurons, as well as about one-third as many cold-sensitive neurons. These neurons are believed to function as temperature sensors for controlling body temperature.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: B. Heat-sensitive neurons increase their firing rate 20 times in response to a 10°C increase in body temperature, which is Incorrect because heat-sensitive neurons increase their firing rate 2-to 10-fold in response to a 10°C increase in body temperature . The cold-sensitive neurons, by contrast, increase their firing rate when body temperature falls.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Hypothalamus plays an active role in the release of all the other anterior pituitary hormones. Hypothalamus has been studied for the secretion of prolactin where the hypothalamus exhibits a specific type of action on the secretion of prolactin. Select the incorrect statements:", "options": [{"label": "A", "text": "Hypothalamus mainly stimulates the production of all the other anterior pituitary hormones.", "correct": false}, {"label": "B", "text": "Damage to the hypothalamus or blockage of the hypothalamic-hypophyseal portal system elevates prolactin secretion.", "correct": false}, {"label": "C", "text": "Brain injury involving damage to the hypothalamus suppresses prolactin secretion.", "correct": true}, {"label": "D", "text": "Hypothalamus contains prolactin inhibitory hormone.", "correct": false}], "correct_answer": "C. Brain injury involving damage to the hypothalamus suppresses prolactin secretion.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Brain injury involving damage to the hypothalamus suppresses prolactin secretion. Brain injury involving damage to the hypothalamus increases prolactin secretion by blocking the hypothalamic-hypophyseal portal system and blocking the release of prolactin inhibitory hormone and increasing the release of prolactin.</p>\n<p><strong>Highyeild:</strong></p><p>Consequently, damage to the hypothalamus or blockage of the hypothalamic-hypophyseal portal system often increases prolactin secretion while it depresses the secretion of the other anterior pituitary hormones. Therefore, it is believed that anterior pituitary secretion of prolactin is controlled either entirely or almost entirely by an inhibitory factor formed in the hypothalamus and transported through the hypothalamic-hypophyseal portal system to the anterior pituitary gland. This factor is sometimes called prolactin inhibitory hormone.</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option: A. The hypothalamus mainly stimulates the production of all the other anterior pituitary hormones Option: B. The damage to the hypothalamus or blockage of the hypothalamic-hypophyseal portal system elevates prolactin secretion Option: D. The hypothalamus contains prolactin inhibitory hormone which controls the release of prolactin. The hypothalamus plays an essential role in controlling prolactin secretion, as it does for almost all the other anterior pituitary hormones. However, this control is different in one aspect: The hypothalamus mainly stimulates the production of all the other hormones, but it mainly inhibits prolactin production.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The image shown below represents a group of magnocellular neurosecretory cells located within the anterior hypothalamus that participate in the HPA axis. Select the best-suited statements:-", "options": [{"label": "A", "text": "When the body fluids become highly diluted, neurons in these areas are stimulated.", "correct": false}, {"label": "B", "text": "Nerve endings secrete an antidiuretic hormone that regulates the amount of water in the body.", "correct": false}, {"label": "C", "text": "The hormone causes loss of water into the urine", "correct": false}, {"label": "D", "text": "Only B correct", "correct": true}], "correct_answer": "D. Only B correct", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683532282720-QTDY015006IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Only B correct The nerve endings secrete an antidiuretic hormone that regulates the amount of water in the body.</p>\n<p><strong>Highyeild:</strong></p><p>In the case of hyperosmotic fluid in the body, nerve endings secrete ADH and it acts on DCT and collecting tubules to reabsorb water and minimize water excretion (antidiuresis). When body fluid is highly diluted, the secretion of ADH is suppressed to enhance the excretion of water and to regulate total body water. Control of renal excretion of water is vested mainly in the supraoptic nuclei. When the body fluids become too concentrated, the neurons of these areas become stimulated. Nerve fibers from these neurons project downward through the infundibulum of the hypothalamus into the posterior pituitary gland, where the nerve endings secrete the hormone antidiuretic hormone (also called vasopressin). This hormone is then absorbed into the blood and transported to the kidneys, where it acts on the collecting tubules and collecting ducts of the kidneys to cause increased reabsorption of water. This action decreases the loss of water into the urine but allows continuing excretion of electrolytes, thus decreasing the concentration of the body fluids back toward normal</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. When the body fluids become highly diluted, neurons of these areas are suppressed and ADH secretion is inhibited leading to diuresis by the kidneys. Option: C. The hormone exerts an antidiuresis effect depending on the volume of fluid in the body to regulate total body water.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The ventromedial hypothalamus (VMH) is a distinct morphological nucleus involved in terminating fear, thermoregulation, and sexual activity. The ventromedial nuclei in the hypothalamus are depicted in the image as, Select the correct statements:", "options": [{"label": "A", "text": "Damage to areas bilaterally causes lethal starvation.", "correct": false}, {"label": "B", "text": "This center opposes the desire for food.", "correct": false}, {"label": "C", "text": "Damage to areas bilaterally causes tremendous obesity.", "correct": false}, {"label": "D", "text": "Both B and C are correct", "correct": true}], "correct_answer": "D. Both B and C are correct", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/questionImage-1688205190965-QTDY015007IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Both B and C are correct Option B. The ventromedial nuclei center opposes the desire for food. Option C. Damage to ventromedial nuclei bilaterally causes tremendous obesity. A center that opposes the desire for food, called the satiety center, is located in the ventromedial nuclei . When this center is stimulated electrically, an animal that is eating food suddenly stops eating and shows complete indifference to food. However, if this area is destroyed bilaterally, the animal cannot be satiated; instead, its hypothalamic hunger centers become overactive, so it has a voracious appetite, resulting eventually in tremendous obesity.</p>\n<p><strong>Highyeild:</strong></p><p>The ventromedial nucleus of the hypothalamus (VMH) is a complex brain structure that is integral to many neuroendocrine functions, including glucose regulation, thermogenesis, and appetitive, social, and sexual behaviors. The brain, particularly the ventromedial hypothalamic nucleus (VMH), has been long known for its involvement in glucose sensing and whole-body glucose homeostasis.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Damage to the lateral hypothalamic area bilaterally causes lethal starvation. One area associated with hunger is the lateral hypothalamic area. Conversely, damage to this area on both sides of the hypothalamus causes the animal to lose the desire for food, sometimes causing lethal starvation.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The suprachiasmatic nucleus (SCN) is a bilateral structure located in the anterior part of the hypothalamus. Its location is shown in the image given below: Select the best-suited functions:-", "options": [{"label": "A", "text": "Serves as a “master clock” for many physiological, mental, and behavioral activities.", "correct": false}, {"label": "B", "text": "Receives direct innervation from the retina via the retinohypothalamic tract.", "correct": false}, {"label": "C", "text": "SCN neurons control various brain centers, which contain local circadian clocks.", "correct": false}, {"label": "D", "text": "All are best-suited functions", "correct": true}], "correct_answer": "D. All are best-suited functions", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683532282901-QTDY015008IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>All are best-suited functions Option A. SCN serves as a “master clock” for many physiological, mental, and behavioral activities. Option B. SCN receives direct innervation from the retina via the retinohypothalamic tract. Option C. SCN neurons control various brain centers , which contain local circadian clocks.</p>\n<p><strong>Highyeild:</strong></p><p>The suprachiasmatic nucleus (SCN) of the hypothalamus serves as a “master clock” for many physiological, mental, and behavioral activities. The SCN receives direct innervation from the retina via the retinohypothalamic tract (RHT) to entrain its activity to day–night cycles. SCN neurons project to various brain centers, which contain local circadian clocks that direct feeding–fasting, sleep–wakefulness, autonomic and neuroendocrine circadian rhythms. These systemic cues synchronize local molecular clocks in peripheral tissues, and these local clocks then direct circadian gene expression that regulates physiological rhythms, including those related to mental alertness and cognition, cardiovascular regulation, metabolism, and renal function</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- All of the above Options are correct and correctly explained above. The suprachiasmatic nucleus (SCN) is a bilateral structure located in the anterior part of the hypothalamus . It is the central pacemaker of the circadian timing system and regulates most circadian rhythms in the body.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A patient of age 34 years presented with symptoms of excessive drinking of water, excessive eating, sweating, anxiety, and occasional events of extreme rage on minor provocation. The patient gave a history of head injury in the previous year while riding a motorcycle. Examination and investigation revealed bilateral lesions in specific regions of the hypothalamus. Select the correct statement:", "options": [{"label": "A", "text": "Bilateral lesions in ventromedial areas of the hypothalamus", "correct": false}, {"label": "B", "text": "Bilateral lesions in the lateral hypothalamus", "correct": false}, {"label": "C", "text": "Sometimes causes lethal starvation", "correct": false}, {"label": "D", "text": "Only A correct", "correct": true}], "correct_answer": "D. Only A correct", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Only A correct Bilateral lesions of the ventromedial areas of the hypothalamus cause effects that are mainly opposite to those caused by lesions of the lateral hypothalamus: excessive drinking and eating, as well as hyperactivity and often frequent bouts of extreme rage on the slightest provocation.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: B. Bilateral lesions in the lateral hypothalamus Bilateral lesions in the lateral hypothalamus will decrease drinking and eating almost to zero, often leading to lethal starvation. These lesions cause extreme passivity in the animal as well, with the loss of most of its overt drives. Option: C. Sometimes causes lethal starvation Bilateral lesions of the lateral hypothalamus cause anorexia (reduced feeding behavior). AgPR inputs from the arcuate nucleus also stimulate feeding behavior.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Synthesis of acetylcholine occurs in the presynaptic terminals. It is released into the synaptic cleft to act on the postsynaptic receptors. Select the irrelevant statements about parasympathetic postganglionic neurons:", "options": [{"label": "A", "text": "Acetylcholine is synthesized by the action of choline-o-acetyltransferase on choline and acetyl coenzyme A.", "correct": false}, {"label": "B", "text": "The release of neurotransmitters is triggered when voltage-sensitive calcium channels open to allow the influx of calcium.", "correct": false}, {"label": "C", "text": "The released acetylcholine acts on postsynaptic nicotinic receptors.", "correct": true}, {"label": "D", "text": "Choline is recycled by being taken back up into the presynaptic terminal.", "correct": false}], "correct_answer": "C. The released acetylcholine acts on postsynaptic nicotinic receptors.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The released acetylcholine acts on postsynaptic nicotinic receptors. Acetylcholine activates mainly two types of receptors, which are called muscarinic and nicotinic receptors . The reason for these names is that muscarine, a poison from toadstools, activates only muscarinic receptors and will not activate nicotinic receptors, whereas nicotine activates only nicotinic receptors.</p>\n<p><strong>Highyeild:</strong></p><p>Acetylcholine activates both of them. Muscarinic receptors, which use G proteins as their signaling mechanism, are found on all effector cells that are stimulated by the postganglionic cholinergic neurons of either the parasympathetic nervous system or the sympathetic system. Nicotinic receptors are ligand-gated ion channels found in autonomic ganglia at the synapses between the preganglionic and postganglionic neurons of both the sympathetic and parasympathetic systems. (Nicotinic receptors are also present at many non-autonomic nerve endings—for example, at the neuromuscular junctions in skeletal muscle).</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Acetylcholine is synthesized by the action of choline-o-acetyltransferase on choline and acetyl coenzyme A. Option: B. Release of neurotransmitters is triggered when voltage-sensitive calcium channels open to allow the influx of calcium. Option: D. Choline is recycled by being taken back up into the presynaptic terminal.</p>\n<p><strong>Extraedge:</strong></p><p>Acetylcholine is synthesized in the terminal endings and varicosities of the cholinergic nerve fibers, where it is stored in vesicles in highly concentrated form until it is released. Once acetylcholine is secreted into tissue by a cholinergic nerve ending, it persists in the tissue for a few seconds while it performs its nerve signal transmitter function. Then it is split into an acetate ion and choline, catalyzed by the enzyme acetylcholinesterase, which is bound with collagen and glycosaminoglycans in the local connective tissue. This mechanism is the same as that for acetylcholine signal transmission and subsequent acetylcholine destruction that occurs at the neuromuscular junctions of skeletal nerve fibers. The choline that is formed is then transported back into the terminal nerve ending, where it is used again and again for the synthesis of new acetylcholine.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Psychotherapists studied the behavior of rats in a closed space. The rats were usually with normal behavior until there was one rat in one closed space. When many rats were enclosed in that space, they all turned on each other. Similarly, far more people on the road are responsible for road rage which must have been experienced by drivers in crowded places. Select the improper statements:", "options": [{"label": "A", "text": "Signals are transmitted downward through the reticular formation of the brain stem and into the spinal cord to cause massive sympathetic discharge.", "correct": false}, {"label": "B", "text": "This is a sympathetic alarm reaction.", "correct": false}, {"label": "C", "text": "Reduced rate of blood coagulation, hyperperfusion of GIT and kidneys", "correct": true}, {"label": "D", "text": "Sympathetic stress response", "correct": false}], "correct_answer": "C. Reduced rate of blood coagulation, hyperperfusion of GIT and kidneys", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Reduced rate of blood coagulation, hyperperfusion of GIT and kidneys When large portions of the sympathetic nervous system discharge at the same time— that is, a mass discharge— this action increases the ability of the body to perform vigorous muscle activity in many ways.</p>\n<p><strong>Highyeild:</strong></p><p>As summarized in the following list: Increased arterial pressure Increased blood flow to active muscles concurrent with decreased blood flow to organs such as the gastrointestinal tract and the kidneys that are not needed for rapid motor activity Increased rates of cellular metabolism throughout the body Increased blood glucose concentration Increased glycolysis in the liver and the muscle Increased muscle strength Increased mental activity Increased rate of blood coagulation</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. After the events of road rage, signals are transmitted down through the reticular formation of the brain stem and into the spinal cord to cause massive sympathetic discharge. The sympathetic system is especially strongly activated in many emotional states. For example, in the state of rage, which is elicited to a great extent by stimulating the hypothalamus, signals are transmitted down through the reticular formation of the brain stem and into the spinal cord to cause massive sympathetic discharge. Option: B. This is a sympathetic alarm reaction. The most aforementioned sympathetic events ensue immediately. Option: D. Also called as sympathetic stress response This is called the sympathetic alarm reaction. It is also called the fight-or-flight reaction because an animal in this state decides almost instantly whether to stand and fight or to run. In either event, the sympathetic alarm reaction makes the animal’s subsequent activities vigorous.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "It is established that Signals from the hypothalamus and even from the cerebrum can affect the activities of almost all the brainstem autonomic control centers. Select the correct statement:", "options": [{"label": "A", "text": "Stimulation in mainly of the posterior hypothalamus can activate the medullary cardiovascular control centers strongly enough to increase arterial pressure to more than twice normal.", "correct": false}, {"label": "B", "text": "The autonomic centers in the brain stem act as relay stations for control activities initiated at higher levels of the brain, especially in the hypothalamus.", "correct": false}, {"label": "C", "text": "Correct A and incorrect B", "correct": false}, {"label": "D", "text": "Both A and B correct", "correct": true}], "correct_answer": "D. Both A and B correct", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Both A and B correct Option A. Stimulation in mainly of the posterior hypothalamus can activate the medullary cardiovascular control centers strongly enough to increase arterial pressure to more than twice normal. Option B. The autonomic centers in the brain stem act as relay stations for control activities initiated at higher levels of the brain, especially in the hypothalamus. Signals from the hypothalamus and even from the cerebrum can affect the activities of almost all the brainstem autonomic control centers. For example, stimulation in appropriate areas—mainly of the posterior hypothalamus— can activate the medullary cardiovascular control centers strongly enough to increase arterial pressure to more than twice normal. Likewise, other hypothalamic centers control body temperature, increase or decrease salivation and gastrointestinal activity, and cause bladder emptying . To some extent, the autonomic centers in the brain stem act as relay stations for control activities initiated at higher levels of the brain, especially in the hypothalamus.</p>\n<p><strong>Highyeild:</strong></p><p>In vertebrate anatomy, the brainstem is the posterior part of the brain adjoining, and structurally continuous with, the spinal cord. Though small, the brainstem is an extremely important part of the brain, as the nerve connections from the motor and sensory systems of the cortex pass through it to communicate with the peripheral nervous system. The brain stem also plays an important role in the regulation of cardiac and respiratory function, consciousness, and the sleep cycle. The brainstem consists of the medulla oblongata, pons, and midbrain.</p>\n<p><strong>Extraedge:</strong></p><p>Pons : Contains nuclei that relay signals from the forebrain to the cerebellum, along with nuclei that deal primarily with sleep, respiration, swallowing, bladder control, hearing, equilibrium, taste, eye movement, facial expressions, facial sensation, and posture. Midbrain : Associated with vision, hearing, motor control, sleep and wake cycles, alertness, and temperature regulation. Medulla : The lower half of the brainstem that contains the cardiac, respiratory, vomiting, and vasomotor centers and regulates autonomic, involuntary functions such as breathing, heart rate, and blood pressure.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The parasympathetic nervous system predominates in quiet “rest and digest” conditions while the sympathetic nervous system drives the “fight or flight” response in stressful situations. The main purpose of the PNS is to conserve energy. The Parasympathetic System generally mediates specific Localized Responses in body organs. Select the correct statements:", "options": [{"label": "A", "text": "Parasympathetic cardiovascular reflexes have a little direct effect on the myocardial force of contraction.", "correct": false}, {"label": "B", "text": "Salivary secretion can occur independently of gastric secretion but often occur simultaneously.", "correct": false}, {"label": "C", "text": "Parasympathetic cardiovascular reflexes act on the heart only to increase or decrease the heart rate.", "correct": false}, {"label": "D", "text": "All of them correct", "correct": true}], "correct_answer": "D. All of them correct", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>All of them correct Control functions by the parasympathetic system are often highly specific. For example, parasympathetic cardiovascular reflexes usually act on the heart only to increase or decrease its rate of beating with a little direct effect on its force of contraction. Likewise, other parasympathetic reflexes cause secretion mainly by the mouth glands, and in other cases, secretion is mainly by the stomach glands. Finally, the rectal emptying reflex does not affect other parts of the bowel to a major extent.</p>\n<p><strong>Highyeild:</strong></p><p>Although salivary secretion can occur independently of gastric secretion, these two often occur together, and pancreatic secretion frequently occurs at the same time. Also, the rectal emptying reflex often initiates a urinary bladder emptying reflex, resulting in simultaneous emptying of both the bladder and the rectum. Conversely, the bladder emptying reflex can help initiate rectal emptying.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "In some cases, all portions of the sympathetic nervous system discharge simultaneously as a complete unit. Conversely, activation can occur in isolated portions of the sympathetic nervous system in other situations. Select the correct option for the activation of SNS in isolated portions:", "options": [{"label": "A", "text": "Heating a skin area causes local vasodilation and enhanced local sweating.", "correct": false}, {"label": "B", "text": "Sympathetic control sweating and blood flow in the skin without affecting other organs.", "correct": false}, {"label": "C", "text": "Correct A and incorrect B", "correct": false}, {"label": "D", "text": "Both A and B correct", "correct": true}], "correct_answer": "D. Both A and B correct", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Both A and B correct In some cases, almost all portions of the sympathetic nervous system discharge simultaneously as a complete unit, a phenomenon called mass discharge. This frequently occurs when the hypothalamus is activated by fright or severe pain. The result is a widespread reaction throughout the body called the alarm or stress response, which is discussed shortly. At other times, the activation occurs in isolated portions of the sympathetic nervous system.</p>\n<p><strong>Highyeild:</strong></p><p>Important examples are the following: During the process of heat regulation, the sympathetic controls sweating and blood flow in the skin without affecting other organs innervated by the sympathetic. Many “local reflexes” involving sensory afferent fibers travel centrally in the peripheral nerves to the sympathetic ganglia and spinal cord and cause highly localized reflex responses. For example, heating a skin area causes local vasodilation and enhanced local sweating, whereas cooling causes the opposite Many of the sympathetic reflexes that control gastrointestinal functions operate by way of nerve pathways that do not even enter the spinal cord, merely passing from the gut mainly to the paravertebral ganglia, and then back to the gut through sympathetic nerves to control motor or secretory activity.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Satiety center is located in:", "options": [{"label": "A", "text": "Lateral hypothalamic area", "correct": false}, {"label": "B", "text": "Perifornical region", "correct": false}, {"label": "C", "text": "The ventromedial nucleus of the hypothalamus", "correct": true}, {"label": "D", "text": "The dorsomedial nucleus of the hypothalamus", "correct": false}], "correct_answer": "C. The ventromedial nucleus of the hypothalamus", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The ventromedial nucleus of the hypothalamus Hypothalamus controls appetite, satiety Ventral posteromedial nucleus (VPN) of the hypothalamus: activates satiety Lateral hypothalamic area: activates hunger, feeding</p>\n<p><strong>Highyeild:</strong></p><p>The ventromedial and lateral nuclei control food intake. The ventromedial nuclei of the hypothalamus serve as a major satiety center. This center is believed to give a sense of nutritional satisfaction that inhibits the feeding center. Electrical stimulation of this region can cause complete satiety, and even in the presence of highly appetizing food, the animal refuses to eat (aphasia). Conversely, destruction of the ventromedial nuclei causes voracious and continued eating until the animal becomes extremely obese, sometimes weighing as much as four times normal.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Lateral hypothalamic area: activates hunger, feeding Option: B. The perifornical area in the posterior lateral hypothalamus has been implicated in several physiological functions including sleep-wakefulness Option: D. The dorsomedial hypothalamic nucleus is a nucleus of the hypothalamus. It is involved in feeding, drinking, body-weight regulation, and circadian activity.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The thermoregulatory center is located at:", "options": [{"label": "A", "text": "Pons", "correct": false}, {"label": "B", "text": "Hypothalamus", "correct": true}, {"label": "C", "text": "Medulla", "correct": false}, {"label": "D", "text": "Mid Brain", "correct": false}], "correct_answer": "B. Hypothalamus", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Hypothalamus The reflex responses activated by cold are controlled by the posterior hypothalamus. Those activated by warmth are controlled primarily by the anterior hypothalamus. Stimulation of the anterior hypothalamus causes cutaneous vasodilation and sweating, and lesions in this region cause hyperthermia, with rectal temperatures sometimes reaching 43°C (109.4°F). Posterior hypothalamic stimulation causes shivering, and the body temperature of animals with posterior hypothalamic lesions falls toward that of the environment.</p>\n<p><strong>Highyeild:</strong></p><p>The ventromedial and lateral nuclei control food intake. The ventromedial nuclei of the hypothalamus serve as a major satiety center. This center is believed to give a sense of nutritional satisfaction that inhibits the feeding center. Destruction of the ventromedial nuclei causes voracious and continued eating. A variety of physiological functions, such as alertness (the sleep-wake cycle), body temperature, and secretion of hormones, exhibit cyclic activity that varies over a 24-h period called circadian rhythms and are controlled by the suprachiasmatic nucleus of the hypothalamus. The paraventricular nucleus secretes oxytocin and vasopressin. Hence, control thirst. The arcuate nucleus secretes gonadotropin-releasing hormone.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Pons : Contains nuclei that relay signals from the forebrain to the cerebellum, along with nuclei that deal primarily with sleep, respiration, swallowing, bladder control, hearing, equilibrium, taste, eye movement, facial expressions, facial sensation, and posture. Option: C. Medulla : The lower half of the brainstem that contains the cardiac, respiratory, vomiting, and vasomotor centers and regulates autonomic, involuntary functions such as breathing, heart rate, and blood pressure. Option: D. Midbrain : Associated with vision, hearing, motor control, sleep and wake cycles, alertness, and temperature regulation.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "In damage to the Preoptic area in the hypothalamus:", "options": [{"label": "A", "text": "Hypothermia", "correct": false}, {"label": "B", "text": "Hyperthermia", "correct": true}, {"label": "C", "text": "Loss of appetite", "correct": false}, {"label": "D", "text": "Increase appetite", "correct": false}], "correct_answer": "B. Hyperthermia", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Hyperthermia Damage to the median preoptic nucleus causes an elevated baseline body temperature. Temperature homeostasis is regulated primarily in the preoptic area (POA) of the hypothalamus.</p>\n<p><strong>Highyeild:</strong></p><p>When the preoptic area is heated, the skin all over the body immediately breaks out in a profuse sweat, whereas the skin blood vessels over the entire body become greatly dilated. This response is an immediate reaction to cause the body to lose heat, thereby helping to return the body temperature toward the normal level. In addition, any excess body heat production is inhibited. If this is damaged, no such mechanism would occur, hence hyperthermia.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Hypothermia progressively depresses the CNS, decreasing CNS metabolism in a linear fashion as the core temperature drops. At core temperatures less than 33°C, brain electrical activity becomes abnormal; between 19°C and 20°C, an electroencephalogram (EEG) may appear consistent with brain death. Option: C. The arcuate nucleus of the hypothalamus controls appetite and contains neurons that express pro-opiomelanocortin (POMC) and cocaine- and amphetamine-regulated transcript (CART), which decrease appetite and increase energy expenditure, and neurons that express the agouti-related protein (AgRP) and neuropeptide Y (NPY). Option: D. Hypothalamus damage. The hypothalamus regulates a person's appetite and lets the body know that the stomach is full. When it becomes damaged, an increase in appetite can occur.</p>\n<p><strong>Extraedge:</strong></p><p>The median preoptic nucleus is highly involved in three main areas. These include osmoregulation, thermoregulation, and sleep homeostasis. Within each area are many functions: The role that the median preoptic nucleus plays in osmoregulation is in blood composition and volume, including fluid and salt balance, and produces responses ranging from behavioral to endocrine. Thermoregulation includes both responses to infection and to decreased core temperature upon cutaneous exposure to cold, both of which involve the median preoptic nucleus as an important mediator of sensory input and regulatory output. Sleep homeostasis is involved in both the onset and maintenance of sleep.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Appetite is stimulated by all of the following peptides, except:", "options": [{"label": "A", "text": "Agouti - Related Peptide (AGRP)", "correct": false}, {"label": "B", "text": "Melanocyte-stimulating hormone (MSH)", "correct": true}, {"label": "C", "text": "Melanin-concentrating hormone (MCH)", "correct": false}, {"label": "D", "text": "Neuropeptide Y", "correct": false}], "correct_answer": "B. Melanocyte-stimulating hormone (MSH)", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Melanocyte-stimulating hormone (MSH) The melanocyte-stimulating hormone produced by the pro-opiomelanocortin (POMC) neuron is an MC4R agonist, and the agouti-related regulatory peptide (AgRP) is an inverse agonist of MC4R, and these antagonistically regulate appetite.</p>\n<p><strong>Highyeild:</strong></p><p>(CCK, cholecystokinin; CRH, corticotropin-releasing hormone; MCH, melanin-concentrating hormone; NPY, neuropeptide Y; PACAP, pituitary adenylate cyclase-activating peptide; PYY, peptide YY; SF-1, steroidogenic factor 1; TRH, thyrotropin-releasing hormone.) Mechanism of appetite regulation by the hypothalamus and peripheral tissues. Leptin secreted by adipocytes travels through the circulation and acts on the hypothalamic arcuate nucleus, and gut peptides such as ghrelin and glucagon-like peptide-1 (GLP-1) act on the hypothalamus through the vagus nerve. Black letters indicate appetite-enhancing peptides and white letters indicate appetite-suppressing peptides; the interactions of these peptides are mediated by the melanocortin 4 (MC4R), gamma amino butyric acid (GABA), and leptin receptors. The melanocyte-stimulating hormone produced by the pro-opiomelanocortin (POMC) neuron is an MC4R agonist, and the agouti-related regulatory peptide (AgRP) is an inverse agonist of MC4R, and these antagonistically regulate appetite. Suppression of POMC neurons by NPY/AgRP neurons through the GABA receptors is also important. Solid lines and dashed lines show the representative transmission of enhancing and suppressing actions, respectively, in the hypothalamus.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Two distinct types of neurons in the arcuate nuclei of the hypothalamus are especially important as controllers of both appetite and energy expenditure : pro-opiomelanocortin (POMC) neurons that produce α– melanocyte-stimulating hormone (α-MSH) together with cocaine- and amphetamine-related transcript (CART) and neurons that produce the orexigenic substances neuropeptide Y (NPY) and agouti-related protein (AGRP).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 28 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A 24-year-old man complains of fatigue, increased daytime somnolence, and periodic sudden loss of muscle tone. Polysomnography confirms the diagnosis of narcolepsy. Narcolepsy is associated with which of the following?", "options": [{"label": "A", "text": "Increased discharge of noradrenergic neurons in the locus coeruleus", "correct": false}, {"label": "B", "text": "Increased discharge of serotonergic neurons in the midbrain raphé", "correct": false}, {"label": "C", "text": "Decreased adenosine levels in the reticular formation", "correct": false}, {"label": "D", "text": "Hypothalamic dysfunction with decreased CSF levels of Orexin", "correct": true}], "correct_answer": "D. Hypothalamic dysfunction with decreased CSF levels of Orexin", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Hypothalamic dysfunction with decreased CSF levels of Orexin Compared to the brains of healthy persons, the brains of persons with narcolepsy often contain fewer hypocretin (orexin)-producing neurons in the hypothalamus.</p>\n<p><strong>Highyeild:</strong></p><p>Narcolepsy is a chronic neurological disorder caused by the brain’s inability to regulate sleep–wake cycles normally. The affected individual experiences a sudden loss of voluntary muscle tone (cataplexy), an eventual irresistible urge to sleep during the daytime, and possibly brief episodes of total paralysis at the beginning or end of sleep. Narcolepsy is also characterized by a sudden onset of REM sleep, unlike normal sleep which begins with non-REM, slow-wave sleep. Narcolepsy has a familial incidence strongly associated with a class II antigen of the major histocompatibility complex on chromosome 6 at the HLA-DR2 or HLA-DQW1 locus, implying a genetic susceptibility to narcolepsy. The HLA complex may increase susceptibility to an immune attack on the neurons producing Orexin in Hypothalamus, leading to their degeneration. Polysomnography also called a sleep study, is a comprehensive test used to diagnose sleep disorders. Polysomnography records your brain waves, the oxygen level in your blood, heart rate and breathing, as well as eye and leg movements during the study.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. The noradrenergic nucleus locus coeruleus (LC) is a tiny cluster of cells located bilaterally in the pons just under the fourth ventricle. Option: B. The raphe nucleus is considered to be part of the reticular formation and is located in the brainstem. It is responsible for the release of serotonin to other parts of the brain. Option: C. In the brain adenosine is an inhibitory neurotransmitter. This means adenosine can act as a central nervous system depressant. In normal conditions, it promotes sleep and suppresses arousal.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A state of unconsciousness from which a person cannot be aroused by sensory or other stimuli is termed Coma which differs from a state of sleep. Physiologists required explanations from students in the best possible statements about Sleep:", "options": [{"label": "A", "text": "Sleep varies from very light sleep to very deep sleep", "correct": false}, {"label": "B", "text": "Brain waves are strong and of low-frequency", "correct": false}, {"label": "C", "text": "Eyes undergo slow movements when the person is asleep", "correct": false}, {"label": "D", "text": "Both A and B correct", "correct": true}], "correct_answer": "D. Both A and B correct", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Both A and B correct Sleep is defined as unconsciousness from which a person can be aroused by sensory or other stimuli. It is to be distinguished from a coma, which is unconsciousness from which a person cannot be aroused.</p>\n<p><strong>Highyeild:</strong></p><p>There are multiple stages of sleep, from very light sleep to very deep sleep. Sleep researchers also divide sleep into two entirely different types of sleep that have different qualities, as described in the following section. Two major types of sleep alternate with each other, (1) rapid eye movement sleep (REM sleep), in which the eyes undergo rapid movements even though the person is still asleep, and (2) slow-wave sleep or non-REM (NREM) sleep, in which the brain waves are strong and of low frequency.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: C. Eyes undergo rapid movements when the person is asleep. Rapid Eye Movement or REM sleep, while the muscles of the body are paralyzed during sleep, the eyes continue to move during a type of sleep called REM (Rapid Eye Movement) sleep which is the time of sleep we are actively dreaming.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The occurrence of bilateral lesions in the medial rostral suprachiasmal area in the anterior hypothalamus led to the activation of excitatory reticular nuclei of the mesencephalon and upper pons secreting more serotonin manifesting as a state of intense wakefulness Neurologist worked on the experimental animals and kept them awake for several days to find out the release of chemicals in their CSF, blood, and urine that promote sleep. Select the correct statement:", "options": [{"label": "A", "text": "Muramyl peptide accumulates in cerebrospinal fluid and blood", "correct": false}, {"label": "B", "text": "Muramyl peptide accumulates in cerebrospinal fluid and urine", "correct": false}, {"label": "C", "text": "Injection of muramyl peptide into the third ventricle induces natural sleep in experimental animals", "correct": false}, {"label": "D", "text": "Both B and C are correct", "correct": true}], "correct_answer": "D. Both B and C are correct", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Both B and C are correct Option: B. Muramyl peptide accumulates in cerebrospinal fluid and urine in animals kept awake for several days Option: C. Injection of muramyl peptide into the third ventricle induces natural sleep in experimental animals</p>\n<p><strong>Highyeild:</strong></p><p>One likely substance has been identified as muramyl peptide, a low-molecular-weight substance that accumulates in the cerebrospinal fluid and urine in animals kept awake for several days. When only micrograms of this sleep-producing substance are injected into the third ventricle, almost natural sleep occurs within a few minutes, and the animal may stay asleep for several hours</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Muramyl peptide does not accumulate in the blood of animals kept awake for several days Experiments have shown that the cerebrospinal fluid and the blood or urine of animals that have been kept awake for several days contain a substance or substances that will cause sleep when injected into the brain ventricular system of another animal.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A male patient at age 56 years came to seek consultation from a psychiatrist with manifestations of inability to fall asleep with eyes closed and mind full of thoughts. The EEG is reported, as shown in the following image. Select the best-suited statements:-", "options": [{"label": "A", "text": "Waves at a frequency of 8–13 Hz and amplitude of 50–100 μv.", "correct": false}, {"label": "B", "text": "Beta rhythms", "correct": false}, {"label": "C", "text": "Marked with decreased levels of attention", "correct": false}, {"label": "D", "text": "Both A and C are best-suited statements", "correct": true}], "correct_answer": "D. Both A and C are best-suited statements", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Both A and C are best-suited statements Option A . EEG shows alpha waves at a frequency of 8–13 Hz and amplitude of 50–100 μv. Option C. This pattern of EEG represents decreased levels of attention.</p>\n<p><strong>Highyeild:</strong></p><p>In adult humans who are awake but at rest with the mind wandering and the eyes closed, the most prominent component of the EEG is a fairly regular pattern of waves at a frequency of 8–13 Hz and amplitude of 50–100 μv when recorded from the scalp. This pattern is the alpha rhythm. It is most marked in the parietal and occipital lobes and is associated with decreased levels of attention. The frequency and magnitude of the EEG rhythm can vary with age, with the use of some drugs, and in some pathological conditions.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: B . Beta rhythms is an incorrect option. When attention is focused on something, the alpha rhythm is replaced by an irregular 13–30 Hz low-voltage activity, the beta rhythm</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Physiologists described the characteristics of brain waves during stage 2 of non-REM sleep with the help of EEG recordings. The image below represents a characteristic pattern. Select the best possible statements:-", "options": [{"label": "A", "text": "Presence of sleep spindles at 7–15 Hz.", "correct": false}, {"label": "B", "text": "The frequent presence of high voltage biphasic waves, K complexes.", "correct": false}, {"label": "C", "text": "The occasional occurrence of sleep spindles at 4–7 Hz", "correct": false}, {"label": "D", "text": "Both A and B are best-suited.", "correct": true}], "correct_answer": "D. Both A and B are best-suited.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Both A and B are best-suited. Stage 2 of non-REM sleep is marked by the appearance of Waves called sleep spindles (7–15 Hz) and occasional high voltage biphasic. Waves are called K complexes. Muscle tone is reduced during this time. Sleep spindles—bursts of 7–15 Hz (sigma frequency band) activity, typically between 0.5 and 2 s in duration—are characteristic transient features of the sleep electroencephalogram (EEG). Spindles are most prominent during N2 sleep and are in fact a defining feature of this stage.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: C. Occasional occurrence of sleep spindles at 4–7 Hz, Incorrect because, Stage 1 of non-REM sleep is the transition from wakefulness to sleep, and the EEG shows a low-voltage, mixed frequency pattern. A theta rhythm (4–7 Hz) can be seen at this stage of Sleep .</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The psychiatrist presented a case history of a female patient at the age of 56 years. The patient presented with complaints of ‘trouble sleeping’ where he described having difficulty falling asleep for a long time at night. The patient’s H/O previous injury, accident, or any medication for the psychosomatic disorder was non-significant. The psychiatrist described the features of EEG as provided below. Select the best-suited statements relevant to the EEG from the list below:-", "options": [{"label": "A", "text": "A pattern of rhythmic slow waves", "correct": false}, {"label": "B", "text": "The occurrence of theta and delta rhythms is normal during sleep", "correct": false}, {"label": "C", "text": "Occurrence of high voltage biphasic waves called K complexes", "correct": false}, {"label": "D", "text": "Both A and B are best suited to Image", "correct": true}], "correct_answer": "D. Both A and B are best suited to Image", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Both A and B are best suited to Image Image is the EEG pattern of deep sleep Delta waves are high-amplitude neural oscillations with a frequency between 0.5 and 4 hertz. The correct Options are:- Option A. A pattern of rhythmic slow waves Option B. Occurrence of theta and delta rhythms is normal during sleep</p>\n<p><strong>Highyeild:</strong></p><p>The image shows stage 4 of non-REM sleep. Thus, the characteristic of deep sleep is a pattern of rhythmic slow waves, indicative of marked synchronization of cortical and thalamic activity; it is sometimes referred to as slow-wave sleep. While the Occurrence of theta and delta rhythms is normal during sleep, their appearance during wakefulness is a sign of brain dysfunction. Sleep is the transition from wakefulness to sleep, the EEG shows a low-voltage, mixed-frequency pattern.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options Option C. The EEG pattern in the image does not exhibit the occurrence of high voltage biphasic waves called K complexes This finding is common in Stage 1 non-REM.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Propofol is a short-acting medication. It brings about a decreased level of consciousness and a lack of memory for events. It is used for starting and maintenance of general anesthesia. Select the correct brain wave pattern shown below induced by propofol administration:-", "options": [{"label": "A", "text": "Induce a rhythm in the EEG that is analogous to the classic alpha rhythm.", "correct": false}, {"label": "B", "text": "The frequency and magnitude of the alpha rhythm are also decreased.", "correct": false}, {"label": "C", "text": "Non-REM sleep can be grouped into three stages", "correct": false}, {"label": "D", "text": "Both A and B are correct", "correct": true}], "correct_answer": "D. Both A and B are correct", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683532245208-QTDY014007IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Both A and B are correct Option A. Propofol can induce a rhythm in the EEG that is analogous to the classic alpha rhythm Option B. Propofol-induced reduction in frequency and magnitude of the alpha rhythm</p>\n<p><strong>Highyeild:</strong></p><p>The frequency and magnitude of the alpha rhythm are also decreased by metabolic and toxic encephalopathies including those due to hyponatremia and vitamin B12 deficiency. The frequency and magnitude of the alpha rhythm are also decreased by metabolic and toxic encephalopathies including those due to hyponatremia and vitamin B12 deficiency. The Frequency of the alpha rhythm is reduced during acute intoxication with alcohol, amphetamines, barbiturates, phenytoin, and antipsychotics. Propofol, a hypnotic/sedative drug, can induce a rhythm in the EEG that is analogous to the classic alpha rhythm.</p>\n<p><strong>Random:</strong></p><p>Explanation for incorrect Option:- Option: C . Incorrect- Non-REM sleep can be grouped into 4 stages.</p>\n<p><strong>Extraedge:</strong></p><p>In a typical night of sleep, a young adult first enters non-REM sleep, passes through stages 1 and 2, and spends 70–100 min in stages 3 and 4. Sleep then lightens, and a REM period follows. This cycle is repeated at intervals of about 90 min throughout the night.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The findings of EEG, EOG, and EMG were provided by the physiologist to the students who were asked to explain them. Select the explanation not suited to the above findings in the image:-", "options": [{"label": "A", "text": "Low-amplitude desynchronized theta EEG waves", "correct": false}, {"label": "B", "text": "Rapid, roving eye movements during this stage of sleep", "correct": false}, {"label": "C", "text": "Raised skeletal muscle tone in proportion to rapid eye movements", "correct": true}, {"label": "D", "text": "Ponto Geniculo-occipital (PGO) spikes", "correct": false}], "correct_answer": "C. Raised skeletal muscle tone in proportion to rapid eye movements", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683532245213-QTDY014008IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Raised skeletal muscle tone in proportion to rapid eye movements There is a loss of skeletal muscle tone despite the presence of rapid eye movements in REM sleep.</p>\n<p><strong>Highyeild:</strong></p><p>The high-amplitude slow waves seen in the EEG during non-REM sleep are periodically replaced by rapid, low-voltage EEG activity in REM sleep. Except for eye movement, there is almost a complete loss of skeletal muscle tone in REM sleep. The threshold for arousal from sleep by sensory stimuli is elevated during this time. Another characteristic of REM sleep is the occurrence of large phasic potentials that originate in the cholinergic neurons in the pons and pass rapidly to the lateral geniculate body and from there to the occipital cortex. They are called Ponto geniculo-occipital (PGO) spikes Figure:- PGO-like waves recorded from the Subthalamic Nucleus of a surgical patient during REM sleep, using deep brain stimulation electrodes. Red lines (top) indicate three recording sites in the Right STN, while Blue lines (bottom) indicate three recording sites in the Left STN.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. REM sleep is linked to low-amplitude desynchronized theta EEG waves Option B. REM phase of sleep is associated with rapid, roving eye movements during this stage of sleep Option D. REM sleep is linked to ponto geniculo-occipital (PGO) spikes.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following is involved in REM sleep?", "options": [{"label": "A", "text": "Amygdala", "correct": false}, {"label": "B", "text": "Locus coeruleus", "correct": true}, {"label": "C", "text": "Tectal nucleus", "correct": false}, {"label": "D", "text": "Fornix", "correct": false}], "correct_answer": "B. Locus coeruleus", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Locus coeruleus The locus coeruleus (LC) releases norepinephrine throughout the brain except when the LC falls silent throughout rapid eye movement (REM) sleep.</p>\n<p><strong>Highyeild:</strong></p><p>The locus coeruleus and the norepinephrine system are involved in the norepinephrine (NE) locus coeruleus (LC) system is integrally involved in the regulation of sleep and waking. The locus coeruleus is a small area located bilaterally and posteriorly at the juncture between the pons and mesencephalon. Nerve fibers from this area spread throughout the brain, and they secrete norepinephrine. Norepinephrine generally excites the brain to increase activity. However, it has inhibitory effects in a few brain areas because of inhibitory receptors at certain neuronal synapses. This system probably plays an important role in causing dreaming, thus leading to a type of sleep called rapid eye movement (REM) sleep.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. The amygdala is anatomically connected with and functionally modulates the brainstem centers involved in arousal and sleep regulation. Recent studies have established amygdala dysfunction in patients with insomnia. Option: C. Tectum, via its connections to premotor centers, controls eye movements, approach, and avoidance movements. Option: D. The fornix is a white matter bundle located in the mesial aspect of the cerebral hemispheres, which connects various nodes of a limbic circuitry and is believed to play a key role in cognition and episodic memory recall.</p>\n<p><strong>Extraedge:</strong></p><p>The locus coeruleus is a nucleus located in the pons. It is near the bottom of the fourth ventricle. The locus coeruleus is now thought to be the primary site of norepinephrine production in the brain. The nucleus sends norepinephrine throughout the cerebral cortex as well as to other systems such as the cerebellum, amygdala, spinal cord, and hippocampus These nerve cells have frequently expanded axons that project through the neuraxis and are the only source of norepinephrine to the neocortex, cerebellum, most of the thalamus region, and the hippocampus. The locus coeruleus (or “blue spot”) interacts with the amygdala, a group of cells near the brain responsible for the emotional It is the primary source of noradrenaline, a neurotransmitter in the brain. The norepinephrine (NE) locus coeruleus (LC) framework is implicated in the control of waking and sleeping processes. Stimulation of the locus coeruleus helps promote wakefulness. Neuromelanin-containing cells in the locus coeruleus start to degrade significantly in Parkinson’s disease. In Alzheimer’s disease (AD), the locus coeruleus deteriorates in the very early stages of disease progression, resulting in a gradual deterioration of noradrenaline nerve fibers of the neocortex and hippocampus.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A person with eyes closed and mind wandering will have the following wave in EEG:", "options": [{"label": "A", "text": "Beta waves", "correct": false}, {"label": "B", "text": "Alpha waves", "correct": true}, {"label": "C", "text": "Delta waves", "correct": false}, {"label": "D", "text": "Theta waves", "correct": false}], "correct_answer": "B. Alpha waves", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Alpha waves Alpha waves are rhythmic waves that occur at frequencies between 8 and 13 cycles/sec and are found in the EEGs of almost all healthy adults when they are awake and in a quiet, resting state of cerebration. These waves occur most intensely in the occipital region but can also be recorded from the parietal and frontal regions of the scalp. Their voltage is usually about 50 microvolts. During deep sleep, the alpha waves disappear.</p>\n<p><strong>Highyeild:</strong></p><p>Alpha rhythm: In adult humans who are awake but at rest with the mind wandering and the eyes closed, a fairly regular pattern of waves at a frequency of 8-13 Hz and amplitude of 50-100 V is recorded on EEG. Most prominent on parietal and occipital associated with decreased levels of attention. Beta waves: When attention is focused on something, the alpha rhythm is replaced by an irregular beta rhythm. It is a 13-30 Hz low-voltage activity. This phenomenon is called alpha block and can be produced by any form of sensory stimulation or mental concentration, such as solving arithmetic problems. Another term for this phenomenon is the arousal or alerting response because it is correlated with the aroused, alert state. It has also been called desynchronization because it represents the breaking up of the obviously synchronized neural activity necessary to produce regular waves. EEG DURING SLEEP Stage 1 NREM sleep is the transition from wakefulness to sleep, the EEG theta rhythm (4-7 Hz). Stage 2 of NREM sleep is marked by the appearance of sinusoidal waves called sleep spindles (7-15 Hz) and occasional high voltage biphasic waves called K complexes. Stage 3 of NREM sleep is characterized by the appearance of a high-amplitude delta rhythm (0.5-4 Hz) in the EEG, associated with a further reduction in arousal, and a further reduction in muscle tone. Stage 4 of non-REM sleep Deep sleep pattern of rhythmic high amplitude slow waves-Delta waves (indicative of marked synchronization of cortical and thalamic activity) is sometimes referred to as slow-wave sleep. While the occurrence of theta and delta rhythms is normal during sleep, their appearance during wakefulness is a sign of brain dysfunction (focal brain damage).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Nightmares are seen in:", "options": [{"label": "A", "text": "REM sleep", "correct": true}, {"label": "B", "text": "NREM stage II", "correct": false}, {"label": "C", "text": "NREM stage III", "correct": false}, {"label": "D", "text": "NREM stage IV", "correct": false}], "correct_answer": "A. REM sleep", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>REM sleep Nightmare syndrome involves dreams during REM sleep and is associated with abnormal psychological tests and psychiatric disorders.</p>\n<p><strong>Highyeild:</strong></p><p>Nightmares are unpleasant or frightening dreams that occur sporadically in virtually all children. The peak incidence occurs between 3 and 6 years of age. Developmental, genetic, psychological, and organic factors have been identified as causes of nightmares. Nightmares usually occur in the middle of the night or in the early morning when rapid eye movement sleep is more common. The content of the nightmare almost always involves a specific danger to the person. On awakening, the child is fully alert and can usually recall the details of the nightmare. Sporadic nightmares are common in children and require reassurance only. If nightmares are frequent and persistent, a psychological evaluation of the patient and family is indicated. Although sporadic nightmares may be normal responses to stress, chronic nightmares can be troublesome. Night terrors are most commonly associated with medication or illness in childhood. Post-traumatic stress disorder produces recurrent and repetitive nightmares. Also remember: REM sleep has several important characteristics: It is an active form of sleep usually associated with dreaming and active bodily muscle movements. The person is even more difficult to arouse by sensory stimuli than during deep slow-wave sleep, and yet people usually awaken spontaneously in the morning during an episode of REM sleep. Muscle tone throughout the body is exceedingly depressed, indicating strong inhibition of the spinal muscle control areas. Heart rate and the respiratory rate usually become irregular, which is characteristic of the dream state. Night terrors: Night terrors are a sleep disorder, resulting from partial arousal during slow-wave sleep (NREM Sleep). They usually occur within 2 hours of sleep onset and are characterized by agitation and unresponsiveness to external stimuli. Night terrors are bizarre sleep disorder that affects young children. The child partially awakes during the night agitated, afraid, and terrified, and cannot be consoled. The child cannot usually recall the events in the dream.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Other Options are not correct because Nightmare syndrome involves dreams during REM sleep.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Sleep is primarily regulated by:", "options": [{"label": "A", "text": "Thalamus", "correct": false}, {"label": "B", "text": "Hypothalamus", "correct": true}, {"label": "C", "text": "Putamen", "correct": false}, {"label": "D", "text": "Limbic cortex", "correct": false}], "correct_answer": "B. Hypothalamus", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Hypothalamus The hypothalamus is the best key center for sleep regulation, with hypothalamic neurotransmitter systems providing the framework for therapeutic advances.</p>\n<p><strong>Highyeild:</strong></p><p>Transitions between sleep and wakefulness manifest a circadian rhythm consisting of an average of 8 h of sleep and 16 h of wakefulness. Nuclei in both the brainstem and hypothalamus are critical for the transitions between these states of consciousness. Damage to the area produces a comatose state. Electrical stimulation of the posterior hypothalamus also produces arousal similar to that elicited by stimulation of the midbrain, while electrical stimulation of the anterior hypothalamus and adjacent basal forebrain region induces sleep. A variety of physiological functions, such as alertness (the sleep-wake cycle), body temperature, and secretion of hormones, exhibit cyclic activity that varies over a 24-h period called circadian rhythms and are controlled by the suprachiasmatic nucleus of the hypothalamus.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Option:- Option: A. The thalamus has a nonphotic influence on sleep, circadian rhythmicity, pineal melatonin production, and secretion. Option: C. The putamen is involved in learning and motor control, including speech articulation, language functions, reward, cognitive functioning, and addiction. Option: D. Strong activation of limbic regions during REM sleep suggests a role in the regulation of emotion.</p>\n<p><strong>Extraedge:</strong></p><p>The paraventricular nucleus secretes oxytocin and vasopressin, The ventromedial and lateral nuclei control food intake The arcuate nucleus secretes gonadotropin-releasing hormone. Jet Lag Disorder: The syndrome is transient, typically lasting 2-14 d depending on the number of time zones crossed, the direction of travel, and the traveler's age and phase-shifting capacity. Travelers who spend more time outdoors at their destination reportedly adapt more quickly than those who remain in hotel or seminar rooms, presumably due to brighter (outdoor) light exposure. Avoidance of antecedent sleep loss or napping in the afternoon before overnight travel can reduce the difficulties associated with extended wakefulness. Low doses of Melatonin are shown to be helpful in preclinical studies. Social jet lag: Bedtimes and wake times on weekends or days off occur 4-8 h later than during the week. Such recurrent displacement of the timing of the sleep-wake cycle is common in adolescents and young adults and is associated with a delayed circadian phase, sleep-onset insomnia, excessive daytime sleepiness, poorer academic performance, and increased risk of both obesity and depressive symptoms.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 22 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "Mrs. Bishnoi, a 36-year-old female, visits the hospital complaining of irritability, nervousness, and panic. She was diagnosed with hypertension by her local doctor due to persistent increased BP records. She also reports that she has chronic constipation and heat intolerance. She feels more heat than others and also has increased sweating. Her abdominal CT scan shows a tumor. Where should this tumor lie according to her symptoms?", "options": [{"label": "A", "text": "Pancreas", "correct": false}, {"label": "B", "text": "Pineal gland", "correct": false}, {"label": "C", "text": "Pituitary gland", "correct": false}, {"label": "D", "text": "Adrenal medulla", "correct": true}], "correct_answer": "D. Adrenal medulla", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Adrenal medulla The adrenal medulla secretes epinephrine and norepinephrine in response to sympathetic nervous system stimulation. A tumor here called pheochromocytoma can produce uncontrolled secretions of catecholamines and therefore increases the sympathetic innervation of all organ systems , which causes signs and symptoms the patient is suffering from. So, option D is correct.</p>\n<p><strong>Highyeild:</strong></p><p>The most common feature of pheochromocytoma is hypertension and paroxysmal hypertension, which may be very disturbing. Pheochromocytomas are situated in the adrenal medulla or the abdomen near the celiac, superior mesenteric, and inferior mesenteric ganglia (sympathetic ganglia). It occurs at all ages but is common at a young age. It is more common in females. There is labile hypertension and anxiety attacks. There is a headache, excessive sweating, and There may be pain in the chest and abdomen, with nausea and vomiting. There may be sudden flushing. Pheochromocytoma is usually suggested by the history of a symptomatic patient, the discovery of an incidental adrenal mass, or the family history of a patient with a familial disease. Sometimes it is detected incidentally.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- A tumor in other organs in other options will not increase the epinephrine or norepinephrine release and hence, will not lead to signs and symptoms the patient has in question. So, not the correct options.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Most peptide and protein hormones are synthesized as:", "options": [{"label": "A", "text": "A secretagogue", "correct": false}, {"label": "B", "text": "A pleiotropic hormone", "correct": false}, {"label": "C", "text": "Proopiomelanocortin (POMC)", "correct": false}, {"label": "D", "text": "A preprohormone", "correct": true}], "correct_answer": "D. A preprohormone", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>A preprohormone Like other polypeptide hormones and related proteins that enter the endoplasmic reticulum, insulin is synthesized as part of a larger preprohormone</p>\n<p><strong>Highyeild:</strong></p><p>This initial preproinsulin has a molecular weight of about 11,500, but it is then cleaved in the endoplasmic reticulum to form proinsulin with a molecular weight of about 9000 and consisting of three chains of peptides, A, B, and C. PTH has been isolated in a pure form. It is first synthesized on the ribosomes in the form of a preprohormone The structures of the genes and preprohormone for TRH, GnRH, somatostatin, CRH, and GRH are known. PreproTRH contains six copies of TRH. Several other preprohormones may contain other hormonally active peptides in addition to the hypophysiotropic hormones.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A patient complains of hydruria (7 liters per day) and polydipsia. Examination reveals no disorders of carbohydrate metabolism. These abnormalities might be caused by the dysfunction of the following endocrine gland:", "options": [{"label": "A", "text": "Adrenal cortex", "correct": false}, {"label": "B", "text": "Adrenal medulla", "correct": false}, {"label": "C", "text": "Adenohypophysis", "correct": false}, {"label": "D", "text": "Neurohypophysis", "correct": true}], "correct_answer": "D. Neurohypophysis", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Neurohypophysis Hydruria and polydipsia in case of no disorders of carbohydrate metabolism are the symptoms of diabetes insipidus – the disease caused by a deficiency of antidiuretic hormone secreted by neurohypophysis .</p>\n<p><strong>Highyeild:</strong></p><p>The neurohypophysis (pars posterior) is a structure that is located at the base of the brain and is the posterior lobe of the pituitary gland. Its embryological origin is from the neuroectodermal layer called the infundibulum. The neurohypophysis is divided into two regions; the pars nervosa and the infundibular stalk. Neurohypophysis is the center for the hormonal secretion of oxytocin and vasopressin.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. The adrenal cortex produces several hormones. The most important are aldosterone (a mineralocorticoid), cortisol (a glucocorticoid), and androgens and estrogen (sex hormones). Option B. The adrenal medulla, the inner part of an adrenal gland, controls hormones that initiate the flight or fight response. The main hormones secreted by the adrenal medulla include epinephrine (adrenaline) and norepinephrine (noradrenaline), which have similar functions. Option C. The anterior pituitary (or adenohypophysis) is a lobe of the gland that is responsible for the synthesis of growth hormone (GH), prolactin (PRL) or luteotropic hormone (LTH), and adrenocorticotropin (ACTH), follicle-stimulating hormone (FSH), luteinizing hormone (LH), and thyroid-stimulating hormone (TSH) or thyrotropin.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "An experimental animal is instrumented to monitor plasma glucose and insulin levels. After a control fasting period to establish a steady state, a test substance is administered to the animal. Shortly after the administration of the substance, there is an increase in the plasma insulin concentration and a fall in the plasma glucose concentration. Which of the following is the most likely substance?", "options": [{"label": "A", "text": "Glucagon", "correct": false}, {"label": "B", "text": "Epinephrine", "correct": false}, {"label": "C", "text": "A Sulfonylurea Compound", "correct": true}, {"label": "D", "text": "Somatostatin", "correct": false}], "correct_answer": "C. A Sulfonylurea Compound", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>A Sulfonylurea Compound The correct answer is a sulfonylurea compound. These compounds block the ATP-inhabitable K+ channel in the beta cells, which causes depolarization and activation of a Ca2+ channel. The influx of Ca2+ stimulates insulin secretion.</p>\n<p><strong>Highyeild:</strong></p><p>As insulin levels rise, there is increased glucose utilization by the liver, muscle, and adipose tissues, causing a fall in the plasma glucose concentration. The major hormones regulating energy metabolism are glucagon and insulin. They are produced and secreted by the alpha and beta cells of the pancreatic islets of Langerhans. Insulin is an anabolic hormone that targets the liver, adipose tissue, and muscle tissue and promotes glycogen synthesis, fatty acid synthesis and triglyceride formation, and protein synthesis. Glucagon targets the liver and is counterregulatory to insulin, promoting glycogenolysis, fatty acid oxidation, and gluconeogenesis. Glucagon action is mediated by G protein–coupled plasma membrane receptor activation of adenylyl cyclase and protein kinase A activation.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Glucagon or glucose would stimulate insulin secretion; however, there would be a transient increase in the plasma glucose concentration. Option B & D. Epinephrine and somatostatin would inhibit insulin secretion.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Growth hormone level is decreased in which of the following conditions?", "options": [{"label": "A", "text": "Hypoglycemia", "correct": false}, {"label": "B", "text": "Fasting", "correct": false}, {"label": "C", "text": "REM Sleep", "correct": true}, {"label": "D", "text": "Exercise", "correct": false}], "correct_answer": "C. REM Sleep", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>REM Sleep Growth hormone(GH) level is decreased during deep sleep . Specifically, it is reduced during REM sleep.</p>\n<p><strong>Highyeild:</strong></p><p>Stimulate Growth Hormone Secretion Inhibit Growth Hormone Secretion Decreased blood glucose Increased blood glucose Decreased blood free fatty acids Increased blood free fatty acids Increased blood amino acids (arginine) Aging Obesity Starvation or fasting, protein deficiency Growth hormone inhibitory hormone (somatostatin) Trauma, stress, excitement Exercise Growth hormone (exogenous) Testosterone, estrogen Deep sleep (stages II and IV) Somatomedins (insulin-like growth factors) Growth hormone-releasing hormone Increased blood glucose Ghrelin Increased blood free fatty acids Aging</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Hypoglycemia, fasting, and exercise cause an increase in GH secretion. GH levels are increased during non-REM sleep. GH levels also decline with age and obesity.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Sodium-iodide symporter is absent in which of the following sites?", "options": [{"label": "A", "text": "Pituitary", "correct": true}, {"label": "B", "text": "Placenta", "correct": false}, {"label": "C", "text": "Parotid", "correct": false}, {"label": "D", "text": "Thyroid", "correct": false}], "correct_answer": "A. Pituitary", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Pituitary Sodium-iodide symporter is absent in the pituitary.</p>\n<p><strong>Highyeild:</strong></p><p>Na+/I- symporter is present in:- Basolateral membranes of thyrocytes facing the capillaries. Salivary glands Gastric mucosa Placenta Ciliary body of the eye Choroid plexus Mammary glands</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Sodium-iodide symporter is present in Placenta, Parotid, and</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 16 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "Physical examination of a 41-year-old narcotic abuser reveals an early systolic murmur. The physician also notes a 7 cm distance between the height of the blood in his right internal jugular vein and the sternal angle (normal = 3 cm). Which of the following conditions is most likely responsible for the physical findings?", "options": [{"label": "A", "text": "Mitral stenosis", "correct": false}, {"label": "B", "text": "Tricuspid regurgitation", "correct": true}, {"label": "C", "text": "Atherosclerosis", "correct": false}, {"label": "D", "text": "Aortic regurgitation", "correct": false}], "correct_answer": "B. Tricuspid regurgitation", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Tricuspid regurgitation The physical findings of an early systolic murmur and a 7 cm distance between the height of the blood in the right internal jugular vein and the sternal angle are most suggestive of tricuspid regurgitation. Tricuspid regurgitation is a valvular heart disease characterized by the backflow of blood from the right ventricle into the right atrium during systole. This can cause a systolic murmur to be heard on auscultation, and can also result in jugular venous distension, which can be seen as an elevated jugular venous pressure and a taller column of blood in the jugular vein.</p>\n<p><strong>Highyeild:</strong></p><p>The combination of an early systolic murmur and high right atrial pressure is indicative of tricuspid regurgitation. This lesion is common in narcotic abusers with infective endocarditis. Early systolic murmurs begin with the first heart sound and end in mid-systole. The higher-than-normal height of the jugular blood column reflects an increased right atrial pressure.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Options A & D: Mitral stenosis and aortic regurgitation produce diastolic murmurs. Mitral stenosis typically presents with a diastolic murmur Option C: Atherosclerosis causes most carotid artery stenosis.</p>\n<p><strong>Extraedge:</strong></p><p>The pansystolic murmur associated with tricuspid regurgitation is high pitched and is loudest in the fourth intercostal space in the parasternal region.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 55-year-old male reports several recent episodes of syncope. An electrocardiogram is performed. Which of the following arrhythmias is most commonly associated with syncope?", "options": [{"label": "A", "text": "Sinus arrhythmia", "correct": false}, {"label": "B", "text": "First-degree heart block", "correct": false}, {"label": "C", "text": "Second-degree heart block", "correct": false}, {"label": "D", "text": "Third-degree heart block", "correct": true}], "correct_answer": "D. Third-degree heart block", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Third-degree heart block Patients with third-degree atrioventricular (AV) block (complete heart block) are frequently hemodynamically unstable; as a result, experience syncope, hypotension, and cardiovascular collapse.</p>\n<p><strong>Highyeild:</strong></p><p>Syncope (fainting) is a transient loss of consciousness caused by inadequate blood flow to the brain. Transient decreases in cerebral blood flow are usually due to one of three general mechanisms: disorders of vascular tone or blood volume, cardiovascular disorders, or cerebrovascular disease. Approximately one-fourth of syncopal episodes are of cardiac origin and are due to either transient obstruction of blood flow through the heart or sudden decreases in cardiac output due to cardiac arrhythmias, such as bradycardia, heart block, or sinus arrest (neuro cardiogenic syncope). Third-degree (complete) heart block results when the conduction of the action potential from the atria to the ventricles is completely interrupted. Under these conditions, pacemaker cells within the His-Purkinje system or the ventricular muscle cause the ventricles to beat at a low rate (idioventricular rhythm) independently of the atria. Although the heart rate may be high enough to adequately perfuse the brain under resting conditions, Third-degree heart block is caused by conduction system disturbances, inferior wall MI, and digitalis toxicity.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. When the conduction disturbance is due to disease in the AV node, the idioventricular rhythm is normally about 45 beats/min. When the conduction disturbance is below the AV node (infranodal block) due to disease in the bundle of His, firing of more peripheral ventricular pacemakers can decrease heart rate to below 30 beats/min with periods of asystole that may last a minute or more. The resultant cerebral ischemia causes dizziness and fainting (Stokes-Adams syndrome). Sinus arrhythmia is a change in the heart rate produced by the normal variation in the rate of phase 4 depolarization of the SA nodal pacemaker cells between inspiration and expiration. Option B. First-degree heart block is defined as a higher-than-normal PR interval (greater than 0.2 seconds). Second-degree heart block occurs when the action potential fails to reach the ventricles some, but not all, of the time. Tachycardia is a heart rate above 100 beats per minute. Option C. There are two non-distinct types of second-degree AV blocks, called Type 1 and Type 2. In both types, a P wave is blocked from initiating a QRS complex; but, in Type 1, there are increasing delays in each cycle before the omission, whereas, in Type 2, there is no such pattern .</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "During a routine physical examination, a 32-year-old female is found to have a second-degree heart block. Which of the following ECG recordings was obtained from the patient during her physical examination?", "options": [{"label": "A", "text": "A", "correct": false}, {"label": "B", "text": "B", "correct": false}, {"label": "C", "text": "C", "correct": true}, {"label": "D", "text": "D", "correct": false}], "correct_answer": "C. C", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683533765455-QTDY036003IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>C Conduction abnormalities can produce first-degree, second-degree, or third-degree heart blocks. In a second-degree heart block, a P wave is not always followed by a QRS complex as in trace C, where the second P wave is not followed by a QRS complex.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Option: D. - It is a case of first-degree heart block as the interval between the beginning of the P wave and the beginning of the QRS complex (the PR interval) is longer than normal (greater than 0.2 seconds). In a third-degree heart block, conduction between the atria and ventricles is completely blocked so the atrial beats (represented by the P waves) and the ventricular beats (represented by the QRS complex) are completely dissociated.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The spouse of a 58-year-old man calls 9-1-1 because her husband complains of chest pain radiating down his left arm. He is transported to the Emergency Department, where an electrocardiogram and cardiac enzymes indicate a recent myocardial infarction. The man is sent for cardiac catheterization, including coronary angiography and hemodynamic recordings throughout the cardiac cycle. No valvular defects were present. During ventricular ejection, the pressure difference is smallest in magnitude between which of the following?", "options": [{"label": "A", "text": "Pulmonary artery and left atrium", "correct": false}, {"label": "B", "text": "Right ventricle and right atrium", "correct": false}, {"label": "C", "text": "Left ventricle and aorta", "correct": true}, {"label": "D", "text": "Left ventricle and left atrium", "correct": false}], "correct_answer": "C. Left ventricle and aorta", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Left ventricle and aorta The pressure gradient between regions of the cardiovascular system is directly proportional to the resistance of the intervening structures. During ventricular ejection, the aortic valves are open and do not offer any significant resistance to blood flow.</p>\n<p><strong>Highyeild:</strong></p><p>Therefore, there is very little, if any, pressure difference between the left ventricle and the aorta. Because the tricuspid valve is closed during ventricular ejection, there is an appreciable pressure difference between the right ventricle and the left atrium, although this pressure difference is opposite in direction to the flow of blood through the circulatory system. Although pulmonary vascular resistance is relatively small compared with systemic vascular resistance, it nonetheless produces a pressure drop between the right ventricle and the left atrium. Because most of the resistance in the systemic vasculature occurs at the level of the arterioles, there is a large pressure gradient between the aorta and the capillaries.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options: Rest options are inappropriate. Ventricular ejection: when the ventricles eject blood to the body (via the aorta) and to the lungs (via the pulmonary artery).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 60-year-old man works in a multinational company in a higher position. He seems to be fit but for the last few days, he is feeling difficulty breathing. And it is getting worse since this morning. So he went to the emergency department of the nearby hospital. In the hospital, he was further asked about his illness. He said that he is also feeling fatigued and weak for the last few months. His vitals were taken. ECG was done and then sent for echocardiography. Echo visualizes a holo-diastolic murmur which can be auscultated on the upper right sternal border. His BP recorded was 158/64 mmHg. Which of the below-given pathologies best describes the above scenario?", "options": [{"label": "A", "text": "Aortic valve stenosis", "correct": false}, {"label": "B", "text": "Aortic valve regurgitation", "correct": true}, {"label": "C", "text": "Pulmonic stenosis", "correct": false}, {"label": "D", "text": "Both A and B", "correct": false}], "correct_answer": "B. Aortic valve regurgitation", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Aortic valve regurgitation The aortic valve is located at the right 2nd intercostal space. And diastolic murmur is heard in aortic valve regurgitation out of the all given options. Murmur heard at the upper right sternal border further adds confirmation to the above explanation. So, the correct answer is B.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Aortic valve stenosis produces a systolic murmur. Option C. Pulmonic valve stenosis also produces systolic murmurs.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following is not a feature of a complete heart block on the ECG?", "options": [{"label": "A", "text": "Constant RR interval", "correct": false}, {"label": "B", "text": "Constant PP interval", "correct": false}, {"label": "C", "text": "Constant PR interval", "correct": true}, {"label": "D", "text": "PP interval shorter than RR interval", "correct": false}], "correct_answer": "C. Constant PR interval", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Constant PR interval PR Interval is prolonged in cases of complete heart block.</p>\n<p><strong>Highyeild:</strong></p><p>COMPLETE HEART BLOCK When conduction from the atria to the ventricles is completely interrupted, complete (third-degree) heart block results, and the ventricles beat at a low rate (idioventricular rhythm) independently of the atria. The block may be due to disease in the AV node (AV nodal block) or the conducting system below the node (infranodal block). In patients with AV nodal block, the remaining nodal tissue becomes the pacemaker and the rate of the idioventricular rhythm is approximately 45 beats/min. In patients with infranodal block due to disease in the bundle of His, the ventricular pacemaker is located more peripherally in the conduction system and the ventricular rate is lower; it averages 35 beats/min, but in individual cases, it can be as low as 15 beats/min. Causes of third-degree heart block include septal myocardial infarction and damage to the bundle of His during surgical correction of congenital interventricular septal defects</p>\n<p><strong>Extraedge:</strong></p><p>Atrioventricular block Representative electrocardiogram recordings of the different degrees of heart block.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 16 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "The parents of a 10-year-old boy consulted a doctor about an extension of hair-covering, growth of beard and mustache, and low voice. Intensified secretion of which hormone must be assumed?", "options": [{"label": "A", "text": "Of Testosterone", "correct": true}, {"label": "B", "text": "Of Somatotropin", "correct": false}, {"label": "C", "text": "Of Progesterone", "correct": false}, {"label": "D", "text": "Of Estrogen", "correct": false}], "correct_answer": "A. Of Testosterone", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Of Testosterone Extension of hair-covering, growth of beard and mustache, and low voice are the signs of masculine physique development. Development of the masculine physique, development of the male reproductive system in the fetus and adolescent, and the sex drive are stimulated by testosterone.</p>\n<p><strong>Highyeild:</strong></p><p>Testosterone is the primary male hormone responsible for regulating sex differentiation, producing male sex characteristics, spermatogenesis, and fertility. It is involved in increasing the protein synthesis in muscles thereby increasing the muscle mass in males. Testosterone's effects are first seen in the fetus. During the first 6 weeks of development, the reproductive tissues of males and females are identical.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: B. Somatotropin, Growth hormone (GH), also known as somatotropin, is a peptide hormone that is synthesized and secreted by the somatotrophs of the anterior pituitary gland. Option: C. Progesterone is a hormone released by the corpus luteum in the ovary . It plays important role in the menstrual cycle and in maintaining the early stages of pregnancy. Option: D. Estrogen regulates the growth, development, and physiology of the human reproductive system. This hormone also influences neuroendocrine, skeletal, adipose, and cardiovascular systems.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 32-year-old lady is undergoing evaluation for polycystic ovary syndrome. Her sex hormone-binding globulin (SHBG) is low. The decrease in sex hormone-binding globulin will have the maximum effect on which of the following hormones?", "options": [{"label": "A", "text": "Estrogen", "correct": false}, {"label": "B", "text": "Testosterone", "correct": true}, {"label": "C", "text": "DHEA", "correct": false}, {"label": "D", "text": "Progesterone", "correct": false}], "correct_answer": "B. Testosterone", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Testosterone The decrease in sex hormone-binding globulin will have the maximum effect on testosterone .</p>\n<p><strong>Highyeild:</strong></p><p>Around 98% of the circulating testosterone is bound to plasma proteins such as sex hormone-binding globulin (65%) and albumin. So, the decrease in sex-hormone-binding globulin (SHBG) or gonadal steroid-binding globulin (GBG) will have the maximum effect on testosterone levels by increasing the levels of its free form. Therefore patients with polycystic ovary syndrome will show features of hyperandrogenism (due to elevated free testosterone).</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Estrogen regulates the growth, development, and physiology of the human reproductive system. This hormone also influences the neuroendocrine, skeletal, adipose, and cardiovascular systems. Option: C. Dehydroepiandrosterone (DHEA) is a hormone that the body naturally produces in the adrenal gland. DHEA helps produce other hormones, including testosterone and estrogen. Option: D. Progesterone is a hormone released by the corpus luteum in the ovary. It plays important role in the menstrual cycle and in maintaining the early stages of pregnancy.</p>\n<p><strong>Extraedge:</strong></p><p>Contraindications to Starting Testosterone Therapy Absolute contraindications Breast cancer Polycythemia (hematocrit > 54%) Prostate cancer Prostate-specific antigen > 4 ng per mL (4 mcg per L) or presence of nodules/induration on digital rectal examination (referral to a urologist is required before considering testosterone therapy) Relative contraindications Baseline hematocrit > 50%* Desire for fertility (testosterone therapy suppresses spermatogenesis) Severe lower urinary tract symptoms Uncontrolled congestive heart failure Untreated obstructive sleep apnea *-The criterion for discontinuing or decreasing testosterone therapy is a rise to a hematocrit of > 54%. A baseline hematocrit of > 50% predicts a likely rise to > 54% on therapy and is therefore a relative contraindication to starting therapy. Information from references 9 and 11.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Testosterone production is mainly contributed by_______ :", "options": [{"label": "A", "text": "Leydig cells", "correct": true}, {"label": "B", "text": "Sertoli cells", "correct": false}, {"label": "C", "text": "Seminiferous tubules", "correct": false}, {"label": "D", "text": "Epididymis", "correct": false}], "correct_answer": "A. Leydig cells", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Leydig cells Testosterone production is mainly contributed by Leydig cells. Testosterone is synthesized from cholesterol in the Leydig cells and also from androstenedione secreted by the adrenal cortex.</p>\n<p><strong>Highyeild:</strong></p><p>The diagnosis of testosterone deficiency should be made only based on clinical signs and symptoms consistent with androgen deficiency, and consistently subnormal serum testosterone concentrations at 8 to 10 AM on three occasions. Testosterone has been used to treat primary or secondary hypogonadism in adult men.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. Sertoli cells produce and secrete the peptide hormone inhibin B into circulation as a response to FSH stimulation. Option C. Spermatozoa are produced within structures called seminiferous tubules. These tubules contain stem cells called spermatogonia (singular is spermatogonium) that derive from primordial germ cells that enter the testis during embryogenesis. Option D. Epididymal function is hormonally regulated. Testosterone and DHT are found in very high concentrations within the epididymis.</p>\n<p><strong>Extraedge:</strong></p><p>LEYDIG CELL: Ledyig cells, also known as interstitial cells of Ledyig, are found adjacent to the seminiferous tubules in the testicle. They produce testosterone in the presence of luteinizing hormone (LH). Ledyig cells are polyhedral in shape, display a large prominent nucleus, an eosinophilic cytoplasm and numerous lipid-filled vesicles. Structure The mammalian Ledyig cell is a polyhedral epithelioid cell with a single eccentrically located ovoid nucleus. The nucleus contains one to three prominent nucleoli and large amounts of dark-staining peripheral heterochromatin. The acidophilic cytoplasm usually contains numerous membrane-bound lipid droplets and large amounts of smooth endoplasmic reticulum (SER) Besides the obvious abundance of SER with scattered patches of rough endoplasmic reticulum, several mitochondria are also prominent within the cytoplasm. Frequently, lipofuscin pigment and rod-shaped crystal-like structures 3 to 20 micrometers in diameter (Reinke crystals) are found. These inclusions have no known function, are found in less than half of all Ledvig cell tumors, but serve to clinch the diagnosis of a Ledyig cell tumor. No other interstitial cell within the testes has a nucleus or cytoplasm with these characteristics, making identification relatively easy Development 'Adult'-type Ledvig cells differentiate in the post-natal testis and are quiescent until puberty. They are preceded in the testis by a population of 'fetal'-type Ledyig cells from the 8th to the 20th week of gestation, which produce enough testosterone for masculinisation of a male fetus, Function Ledvig cells release a class of hormones called androgens (19-carbon steroids) They secrete testosterone, androstenedione and dehydroepiandrosterone (DHEA), when stimulated by the pituitary hormone luteinizing hormone (LH). LH increases cholesterol desmolase activity (an enzyme associated with the conversion of cholesterol to pregnenolone), leading to testosterone synthesis and secretion by Ledvig cells. Prolactin (PRL) increases the response of Ledvig cells to LH by increasing the number of LH receptors expressed on Ledyig cells. Clinical significance Ledvig cells may grow uncontrollably and form a Ledvig cell tumor. These tumors are usually benign. They may be hormonally active, i.e. secrete testosterone Adrenomycloneuropathy is another example of a disease affecting the Ledvig cell: the patient's testosterone may fall despite higher-than-normal levels of LH and follicle-stimulating hormone (FSH). Lateral electrical surface stimulation therapy has been found to destroy Ledvig cells</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The blood-testis barrier is formed by:", "options": [{"label": "A", "text": "Tight junctions between adjacent Leydig cells", "correct": false}, {"label": "B", "text": "Tight junctions between adjacent Sertoli cells", "correct": true}, {"label": "C", "text": "Basal lamina and spermatogonia", "correct": false}, {"label": "D", "text": "Basal lamina and leydig cells", "correct": false}], "correct_answer": "B. Tight junctions between adjacent Sertoli cells", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Tight junctions between adjacent Sertoli cells The blood-testis barrier is formed by the tight junctions between adjacent Sertoli cells.</p>\n<p><strong>Highyeild:</strong></p><p>This Sertoli-Sertoli cell tight junctions divide the seminiferous epithelium into 2 compartments: Basal compartment - contains the spermatogonia and early-stage primary spermatocytes. Adluminal compartment - contains later-stage primary spermatocytes and all subsequent stages of sperm cells. It imparts a selective permeability, allowing few substances such as testosterone to cross but preventing noxious substances that might damage the developing sperm. It also protects sperm from antibodies by creating a specialized, immunologically safe microenvironment for developing sperm.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest Options are incorrect because The blood-testis barrier is formed by basal tight junctions between adjacent Sertoli cells; these serve to compartmentalize the seminiferous tubule into basal and adluminal compartments.</p>\n<p><strong>Extraedge:</strong></p><p>Sertoli cells create the blood-testis barrier that divides the seminiferous epithelium into 2 compartments, basal and adluminal. Schematic of the Blood-Testis Barrier.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The production of estradiol by the testes requires:", "options": [{"label": "A", "text": "Sertoli cell follistatin", "correct": false}, {"label": "B", "text": "LH and Leydig cells", "correct": false}, {"label": "C", "text": "Activin but not LH", "correct": false}, {"label": "D", "text": "Leydig cell, Sertoli cells, LH, and FSH", "correct": true}], "correct_answer": "D. Leydig cell, Sertoli cells, LH, and FSH", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Leydig cell, Sertoli cells, LH, and FSH The estradiol in testicular venous blood comes from the Leydig cells, but some is also produced by the aromatization of androgens in Sertoli cells and Also LH and FSH.</p>\n<p><strong>Highyeild:</strong></p><p>Over 80% of the estradiol and 95% of the estrone in the plasma of adult men is formed by extragonadal and extra-adrenal aromatization of circulating testosterone and androstenedione. FSH is tropic for Sertoli cells, and FSH and androgens maintain the gametogenic function of the testes. FSH also stimulates the secretion of ABP and inhibin. Inhibin feeds back to inhibit FSH secretion. LH is tropic for Leydig cells and stimulates the secretion of testosterone, which in turn feeds back to inhibit LH secretion. In testicular cells, estradiol is known to regulate numerous aspects of spermatogenesis , including proliferation, differentiation, survival, and apoptosis of germ cells.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest options are incorrect and already</p>\n<p><strong>Extraedge:</strong></p><p>LEYDIG CELL: Ledyig cells, also known as interstitial cells of Ledyig, are found adjacent to the seminiferous tubules in the testicle. They produce testosterone in the presence of luteinizing hormone (LH). Ledyig cells are polyhedral in shape, display a large prominent nucleus, an eosinophilic cytoplasm and numerous lipid-filled vesicles. Structure The mammalian Ledyig cell is a polyhedral epithelioid cell with a single eccentrically located ovoid nucleus. The nucleus contains one to three prominent nucleoli and large amounts of dark-staining peripheral heterochromatin. The acidophilic cytoplasm usually contains numerous membrane-bound lipid droplets and large amounts of smooth endoplasmic reticulum (SER) Besides the obvious abundance of SER with scattered patches of rough endoplasmic reticulum, several mitochondria are also prominent within the cytoplasm. Frequently, lipofuscin pigment and rod-shaped crystal-like structures 3 to 20 micrometers in diameter (Reinke crystals) are found. These inclusions have no known function, are found in less than half of all Ledvig cell tumors, but serve to clinch the diagnosis of a Ledyig cell tumor. No other interstitial cell within the testes has a nucleus or cytoplasm with these characteristics, making identification relatively easy Development 'Adult'-type Ledvig cells differentiate in the post-natal testis and are quiescent until puberty. They are preceded in the testis by a population of 'fetal'-type Ledyig cells from the 8th to the 20th week of gestation, which produce enough testosterone for masculinisation of a male fetus, Function Ledvig cells release a class of hormones called androgens (19-carbon steroids) They secrete testosterone, androstenedione and dehydroepiandrosterone (DHEA), when stimulated by the pituitary hormone luteinizing hormone (LH). LH increases cholesterol desmolase activity (an enzyme associated with the conversion of cholesterol to pregnenolone), leading to testosterone synthesis and secretion by Ledvig cells. Prolactin (PRL) increases the response of Ledvig cells to LH by increasing the number of LH receptors expressed on Ledyig cells. Clinical significance Ledvig cells may grow uncontrollably and form a Ledvig cell tumor. These tumors are usually benign. They may be hormonally active, i.e. secrete testosterone Adrenomycloneuropathy is another example of a disease affecting the Ledvig cell: the patient's testosterone may fall despite higher-than-normal levels of LH and follicle-stimulating hormone (FSH). Lateral electrical surface stimulation therapy has been found to destroy Ledvig cells</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which is a true statement regarding Inhibin?", "options": [{"label": "A", "text": "Increases the secretion of GnRH", "correct": false}, {"label": "B", "text": "Molecular weight is between 5000 and 10,000", "correct": false}, {"label": "C", "text": "It is secreted by the hypothalamus", "correct": false}, {"label": "D", "text": "It is a glycoprotein", "correct": true}], "correct_answer": "D. It is a glycoprotein", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>It is a glycoprotein It is a glycoprotein-Inhibin is a glycoprotein, like both LH and FSH, with a molecular weight between 10,000 and 30,000.</p>\n<p><strong>Highyeild:</strong></p><p>Inhibin is a protein secreted by the Sertoli cells in men and by the granulosa cells in women. It inhibits the synthesis and release of the follicle-stimulating hormone in the pituitary gland and reduces the hypothalamic LH - releasing hormone content.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Increases the secretion of GnRH.- it is believed that inhibin might be especially important in causing the decrease in the secretion of FSH and LH at the end of the monthly female sexual cycle. These feedback effects seem to operate mainly on the anterior pituitary gland directly, but they also operate to a lesser extent on the hypothalamus to decrease the secretion of GnRH, especially by altering the frequency of the GnRH pulses. Option: B. Molecular weight is between 5000 and 10,000.- Inhibin is a glycoprotein, like both LH and FSH, with a molecular weight between 10,000 and 30,000. Option: C. It is secreted by the -. negative feedback effect on the anterior pituitary is believed to be secretion by the Sertoli cells of still another hormone called inhibin.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 16 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "The extracellular concentration of a positive ion (with valency1) is 10 mmol/L and its intracellular concentration is 10 mmol/L, the potential across the membrane using the Nernst equation is (mV):", "options": [{"label": "A", "text": "-60", "correct": false}, {"label": "B", "text": "-10", "correct": false}, {"label": "C", "text": "60", "correct": true}, {"label": "D", "text": "10", "correct": false}], "correct_answer": "C. 60", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>60 The potential across the membrane using the Nernst equation is +60mV. EMF (millivolts) = 1/z 61x log Concentration on one side/Concentration on another side. Where Z is valency . Deriving the numerical value: EMF=61*log 100/10 =61*log10. =61*1 (since log 10 =1) =61mV Deciding the charge: The higher potassium concentration in the extracellular fluid means the potassium ions diffuse into the cell. To prevent this, a positive potential is required inside the cell. Hence, the potential across the membrane using the Nernst equation is +60mV .</p>\n<p><strong>Highyeild:</strong></p><p>The Nernst equation is used to calculate the value of the equilibrium potential of a particular cell for a particular ion:- where Vm = equilibrium potential for any ion [V]; z = valence of the ion, [C]0= concentration of ion X outside of the cell [mol]; [C]i = concentration of ion X inside the cell [mol].</p>\n<p><strong>Extraedge:</strong></p><p>The table below summarizes the main direction of movement for various ions and the overall impact this has on the resting membrane potential of a neuron:- lon Overall direction of movement Overall impact on resting potential Potassium Extracellular Makes it more negative Sodium Intracellular Makes it more positive Chloride Intracellular Makes it more negative (small impact) Organic anions Cannot cross the membrane Makes it more negative (small impact) Stimulus starts the rapid change in voltage or action potential. In patch-clamp mode, sufficient current must be administered to the cell in order to raise the voltage above the threshold voltage to start membrane depolarization. Depolarization is caused by a rapid rise in membrane potential opening of sodium channels in the cellular membrane, resulting in a large influx of sodium ions. Membrane Repolarization results from rapid sodium channel inactivation as well as a large efflux of potassium ions resulting from activated potassium channels. Hyperpolarization is a lowered membrane potential caused by the efflux of potassium ions and closing of the potassium channels. Resting state is when membrane potential returns to the resting voltage that occurred before the stimulus occurred.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 35-year-old woman collapsed due to an anxiety attack. The Emergency Medical Team who arrives on the scene notes that she is hyperventilating and suspects that she is suffering from tetany, a continuous contraction of skeletal muscle fibers caused by an increase in the excitability of nerves and muscle membranes. The increased membrane excitability is caused by which of the following?", "options": [{"label": "A", "text": "Decreased release of inhibitory neurotransmitters from nerve terminals", "correct": false}, {"label": "B", "text": "Depolarization of the nerve and muscle membranes", "correct": true}, {"label": "C", "text": "Spontaneous release of calcium from the sarcoplasmic reticulum", "correct": false}, {"label": "D", "text": "Activation of sodium channels at more negative membrane potentials", "correct": false}], "correct_answer": "B. Depolarization of the nerve and muscle membranes", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Depolarization of the nerve and muscle membranes Membrane excitability is related to the ease with which depolarization opens channels.</p>\n<p><strong>Highyeild:</strong></p><p>The opening of the Na+ channel in response to depolarization is, in part, related to the extracellular Ca2+ concentration; the lower the extracellular Ca2+ concentration, the easier it is for Na+ channels to open when the membrane depolarizes. Hyperventilation (lowering arterial tension) decreases extracellular Ca2+ concentration by increasing arterial pH. When pH rises, H+ is released from plasma proteins in exchange for Ca2+, and ionized Ca2+ concentration decreases.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 32-year-old woman undergoing surgery for appendicitis develops malignant hyperthermia following halothane anesthesia. The life-threatening increase in metabolic rate and body temperature is attributed to a mutation of the ryanodine receptor in skeletal muscle, resulting in which of the following?", "options": [{"label": "A", "text": "Excess calcium is released from the sarcoplasmic reticulum (SR) during muscle contraction.", "correct": true}, {"label": "B", "text": "The rapid repetitive firing of the presynaptic terminals of motor neurons.", "correct": false}, {"label": "C", "text": "The inability of skeletal muscle cells to repolarize.", "correct": false}, {"label": "D", "text": "An increase in the refractory period of the motor neurons.", "correct": false}], "correct_answer": "A. Excess calcium is released from the sarcoplasmic reticulum (SR) during muscle contraction.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Excess calcium is released from the sarcoplasmic reticulum (SR) during muscle contraction. Malignant Hyperthermia is associated with a genetic defect in the RyR1Q calcium channel of the skeletal muscle sarcoplasmic reticulum that permits uncontrolled calcium release from the sarcoplasmic reticulum when precipitating drugs are given.</p>\n<p><strong>Highyeild:</strong></p><p>The ryanodine receptor or calcium release channel on the sarcoplasmic reticulum (SR) is normally opened when skeletal muscle is activated. The flow of calcium through the open ryanodine receptor binds to troponin and initiates muscle contraction. The metabolic activity accompanying muscle contraction can warm the body. If a mutation in the ryanodine receptor causes the uncontrolled release of calcium from the SR, the body temperature can rise to levels that cause brain damage.</p>\n<p><strong>Extraedge:</strong></p><p>Serotonin Syndrome: Serotonin syndrome occurs when an overdose of a single drug, or concurrent use of several drugs, results in excess serotonergic activity in the central nervous system. SHT2 receptors are thought to be involved. Dantrolene is of no value. Neuroleptic malignant syndrome: is idiosyncratic and appears to be associated with hypersensitivity to the parkinsonism-inducing effects of D2-blocking antipsychotics in certain individuals.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "At which point on the action potential shown in the diagram below is the membrane closest to the Na+ equilibrium potential?", "options": [{"label": "A", "text": "Point A", "correct": true}, {"label": "B", "text": "Point B", "correct": false}, {"label": "C", "text": "Point C", "correct": false}, {"label": "D", "text": "Point D", "correct": false}], "correct_answer": "A. Point A", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Point A The Na+ equilibrium potential is approximately +60 mV and is based on the ratio of the intracellular and extracellular Na+ concentrations. During an action potential, the peak of the action potential (point A) is close, but not equal, to the Na+ equilibrium potential.</p>\n<p><strong>Highyeild:</strong></p><p>The membrane potential doesn’t reach the Na+ equilibrium potential because the Na+ channels start to inactivate and the K+ channels begin to activate during the upstroke of the action potential. The increase in the Na+ influx leads to further A positive feedback cycle rapidly moves the membrane potential toward its peak value, which is close but not equal to the Na+ equilibrium potential.</p>\n<p><strong>Extraedge:</strong></p><p>What is an action potential? An action potential is a rapid rise and subsequent fall in voltage or membrane potential across a cellular membrane with a characteristic pattern. The stimulus starts the rapid change in voltage or action potential. In patch-clamp mode, sufficient current must be administered to the cell to raise the voltage above the threshold voltage to start membrane depolarization. Depolarization is caused by a rapid rise in membrane potential opening of sodium channels in the cellular membrane, resulting in a large influx of sodium ions. Membrane Repolarization results from rapid sodium channel inactivation as well as a large efflux of potassium ions resulting from activated potassium channels. Hyperpolarization is a lowered membrane potential caused by the efflux of potassium ions and the closing of the potassium channels. The resting state is when membrane potential returns to the resting voltage that occurred before the stimulus occurred.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Suppose a resting myocardial cell membrane is altered to be relatively more permeable to sodium than to potassium, then the resting membrane potential would be nearest to which of the following values?", "options": [{"label": "A", "text": "-96 mV", "correct": false}, {"label": "B", "text": "-90 mV", "correct": false}, {"label": "C", "text": "+60 mV", "correct": true}, {"label": "D", "text": "+134 mV", "correct": false}], "correct_answer": "C. +60 mV", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>+60 mV If a cell membrane is relatively permeable to one ion and impermeable to other ions , then the resting membrane potential of the cell will be near the equilibrium potential for the ion that it is more permeable. In this case, the membrane is most permeable to sodium, so the resting membrane potential will be closest to the sodium equilibrium potential, which is +60 mV. So, the correct answer is C and the rest of the other options are false.</p>\n<p><strong>Highyeild:</strong></p><p>The resting membrane potential of a neuron is usually -65 millivolts. The interior of the cell has a more negative charge as compared to the exterior of the cell. But when a stimulus arrives, the sodium channels of the neuron “open” to allow Na+ ions to move passively into the cell. This will make the neuron becomes less negative, i.e., -55 mV, which could further go beyond the threshold until it becomes positive (e.g., 30 mV).</p>\n<p><strong>Extraedge:</strong></p><p>Summary of resting potential values in different types of cells Cell Kinds Values Chondrocytes -8mV Skeletal muscle cells -95 mV Erythrocytes -8.4 mV Astroglia -80 to -90 mV Cochlea -15 to -40mV Neurons -60 to -70 mV Photoreceptors -40 mV Involuntary muscles -60 mV Smooth muscles of the aorta -45mV</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The true statement regarding the action potential in a nerve is:", "options": [{"label": "A", "text": "Depolarization is a result of the outward movement of potassium ions.", "correct": false}, {"label": "B", "text": "The action potential occurs due to the sudden opening of Na+ channels.", "correct": true}, {"label": "C", "text": "The action potential occurs when the potential reaches a threshold at -75 mV.", "correct": false}, {"label": "D", "text": "The resting membrane potential is -95 mV.", "correct": false}], "correct_answer": "B. The action potential occurs due to the sudden opening of Na+ channels.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The action potential occurs due to the sudden opening of Na+ channels. The action potential occurs due to the sudden opening of Na+ channels- at the onset of the action potential, the sodium channels instantaneously become activated and allow up to a 5000-fold increase in sodium conductance.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. The depolarization is a result of the outward movement of potassium ions-Depolarization Stage. At this time, the membrane suddenly becomes permeable to sodium ions, allowing tremendous numbers of positively charged sodium ions to diffuse to the interior of the axon. Option: C. The action potential occurs when the potential reaches a threshold at -65 mV. Option: D. The resting membrane potential is -90 mV. In neurons, the resting membrane potential is usually about -70 mV.</p>\n<p><strong>Extraedge:</strong></p><p>What is an action potential? An action potential is a rapid rise and subsequent fall in voltage or membrane potential across a cellular membrane with a characteristic pattern. The stimulus starts the rapid change in voltage or action potential. In patch-clamp mode, sufficient current must be administered to the cell to raise the voltage above the threshold voltage to start membrane depolarization. Depolarization is caused by a rapid rise in membrane potential opening of sodium channels in the cellular membrane, resulting in a large influx of sodium ions. Membrane Repolarization results from rapid sodium channel inactivation as well as a large efflux of potassium ions resulting from activated potassium channels. Hyperpolarization is a lowered membrane potential caused by the efflux of potassium ions and the closing of the potassium channels. The resting state is when membrane potential returns to the resting voltage that occurred before the stimulus occurred.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Gibbs-Donnan equilibrium explains the:", "options": [{"label": "A", "text": "Effect of one non-diffusible ion on the distribution of another non-diffusible ion.", "correct": false}, {"label": "B", "text": "Effect of one permeant ion on the distribution of another permeant ion.", "correct": false}, {"label": "C", "text": "Effect of a permeant ion on the distribution of non-diffusible ions.", "correct": false}, {"label": "D", "text": "Effect of a non-diffusible ion on the distribution of permeant ions.", "correct": true}], "correct_answer": "D. Effect of a non-diffusible ion on the distribution of permeant ions.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Effect of a non-diffusible ion on the distribution of permeant ions. Gibbs Donnan equilibrium explains the effect of non-diffusible ions on the distribution of permeant ions.</p>\n<p><strong>Highyeild:</strong></p><p>Donnan equilibrium across a cell membrane (schematic):- The Donnan effect is tactic pressure attributable to cations (Na+ and K+) attached to dissolved plasma proteins. In the simple model system above, Cl- will diffuse from 1 →2, and Na+ will follow to maintain electroneutrality. In compartment 2 then, Cl- will be present and [Na+]equil. > [Na]initial at Donnan equilibrium. Because of the asymmetrical distribution of the permeant ions, there must be a Vm that simultaneously satisfies their equilibrium distributions.</p>\n<p><strong>Extraedge:</strong></p><p>Gibbs-Donnan equilibrium explains the effect of a permeant ion on the distribution of non-diffusible ions. The equilibrium occurs when a semi-permeable membrane separates two solutions containing non-diffusible ions and permeant ions at different concentrations. The non-diffusible ions cannot cross the membrane, while the permeant ions can.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following would cause an immediate reduction in the amount of potassium leaking out of a cell?", "options": [{"label": "A", "text": "Increasing the permeability of the membrane to potassium", "correct": false}, {"label": "B", "text": "Hyperpolarizing the membrane potential", "correct": true}, {"label": "C", "text": "Decreasing the extracellular potassium concentration", "correct": false}, {"label": "D", "text": "Reducing the activity of the sodium-potassium pump", "correct": false}], "correct_answer": "B. Hyperpolarizing the membrane potential", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Hyperpolarizing the membrane potential Hyperpolarizing the membrane makes the inside of the cell more negative and therefore, makes it more difficult for potassium to flow out of the cell.</p>\n<p><strong>Highyeild:</strong></p><p>The amount of potassium leaking out of the cell depends on its membrane potential, its concentration gradient, and its membrane conductance. According to the Nernst equation, the electrical gradient for K+ is inward and the concentration gradient is outward. Decreasing the extracellular potassium concentration would increase the flow of potassium out of the cell, as would increasing the permeability of the membrane to potassium. Altering the activity of the sodium-potassium pump or the extracellular sodium concentration has no immediate effect on the flow of potassium across the membrane. Decreasing the activity of the sodium-potassium pump will ultimately depolarize the membrane, however, resulting in an increased flow of potassium out of the cell.</p>\n<p><strong>Extraedge:</strong></p><p>Hyperpolarization is when the membrane potential becomes more negative at a particular spot on the neuron's membrane. The slow K+ gates remain open longer than is needed to restore the resting state. This excessive efflux causes hyperpolarization of the membrane.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "End plate potential follows which law?", "options": [{"label": "A", "text": "All or none law", "correct": true}, {"label": "B", "text": "Depolarisation", "correct": false}, {"label": "C", "text": "Hyperpolarization", "correct": false}, {"label": "D", "text": "Propagation", "correct": false}], "correct_answer": "A. All or none law", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>All or none law The events occurring during the transmission of impulses from the motor nerve to the muscle are somewhat similar to those occurring at neuron-to-neuron synapses . The End Plate Potential (EPP) follows the All or None Law.</p>\n<p><strong>Highyeild:</strong></p><p>The impulse arriving at the end of the motor neuron increases the permeability of its endings to Ca2+. Ca2+ enters the endings and triggers a marked increase in exocytosis of the acetylcholine-containing vesicles. The acetylcholine diffuses to the muscle-type nicotinic acetylcholine receptors, which are concentrated at the tops of the junctional folds of the membrane of the motor end plate. The binding of acetylcholine to these receptors increases the Na+ and K+ conductance of the membrane, and the resultant influx of Na+ produces a depolarizing potential, the end plate potential.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. Depolarization is a process in which the membrane potential of a cell becomes less negative , or more positive, than its resting potential. This occurs when positively charged ions, such as sodium (Na+) or calcium ( Ca2+ ), enter the cell, or negatively charged ions, such as chloride ( Cl- ) ions, leave the cell. Option C. Hyperpolarization is a process in which the membrane potential of a cell becomes more negative than its resting potential, typically due to the efflux of potassium (K+) ions from the cell or the influx of chloride (Cl-) ions into the cell . Option D. The End Plate Potential ( EPP ) is not related to propagation.</p>\n<p><strong>Extraedge:</strong></p><p>An all-or-none action potential is generated in an axon when membrane depolarization reaches a level at which voltage-gated Na+ channels open, increasing PNa. This results in an inward current of Na+, which causes further depolarization, which then opens additional Na+ channels. This regenerative (positive feedback) cycle quickly produces an overshooting action potential.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The resting transmembrane potential (Vm ) of a nerve axon is essential for signal generation. Instantaneous elimination of which of the following would most rapidly bring Vm close to 0 mV?", "options": [{"label": "A", "text": "Active transport of K+ out of the cell", "correct": false}, {"label": "B", "text": "Active transport of Na+ out of the cell", "correct": false}, {"label": "C", "text": "Concentration gradient for Na+", "correct": false}, {"label": "D", "text": "High membrane permeability to K+", "correct": true}], "correct_answer": "D. High membrane permeability to K+", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>High membrane permeability to K+ The immediate cause of the resting potential is the high membrane permeability to K+ compared with other ions; if this permeability were to be eliminated, Vm would instantly depolarize to within several mV of 0 mV. It would not quite reach 0 mV because of the electrogenic effect of the Na+-K+-ATPase (which pumps three Na+ ions out for every two K+ ions pumped in).</p>\n<p><strong>Highyeild:</strong></p><p>The diffusion of K+ down its concentration gradient in the absence of diffusion of anions out of the cell or diffusion of other cations into the cell causes a slight separation of charge across the membrane that generates most of the resting potential.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B & C: The active transport of K+ into the cell (not, as in Option A, out of the cell) is necessary for setting up the concentration gradient that results in the diffusion of K+ out of the cell. This gradient (and therefore Vm) would take a long time to dissipate if active transport were stopped. Because the membrane is effectively impermeable to Na+ at rest, the transport and concentration gradient for Na+ has very little effect on the resting potential .</p>\n<p><strong>Extraedge:</strong></p><p>The resting potential is generated by the high permeability of the membrane to K+ compared with other ions, which allows a very small amount of K+ to diffuse out of the cell in the absence of net diffusion of other ions, causing a charge separation across the membrane.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Hyperkalemia reduces the excitability of neurons and muscle cells. Which of the following best describes the effect of increased extracellular potassium [K+]?", "options": [{"label": "A", "text": "Depolarizes the cell, thus reducing action potential amplitude.", "correct": false}, {"label": "B", "text": "Depolarizes the cell, thus inactivating voltage-gated Na+ channels.", "correct": true}, {"label": "C", "text": "Hyperpolarizes the cell, which increases the action potential threshold.", "correct": false}, {"label": "D", "text": "Increases the activity of the Na-K-ATPase, which hyperpolarizes the cell.", "correct": false}], "correct_answer": "B. Depolarizes the cell, thus inactivating voltage-gated Na+ channels.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Depolarizes the cell, thus inactivating voltage-gated Na+ channels. Sustained depolarization, as occurs with hyperkalemia, inactivates voltage-gated Na+ channels, which remain inactivated until the membrane repolarizes, thus blocking action potential generation.</p>\n<p><strong>Highyeild:</strong></p><p>An action potential is generated when membrane depolarization reaches a level at which voltage-gated Na+ channels open, increasing PNa+ (or, in electrical terms, gNa), which results in an inward current of Na+, which causes further depolarization, opening additional Na+ channels in a positive feedback cycle. Inactivation of Na+ channels during an action potential prevents subsequent action potential initiation during the brief absolute refractory period, whereas the relative refractory period continues shortly thereafter because the delayed rectifier K+ channels remain open for a somewhat longer period.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options: If action potentials are generated, their amplitude will be reduced (Option A), but this is a consequence rather than a cause of reduced excitability . Hyperpolarization also can reduce excitability by increasing the depolarization needed to reach the action potential threshold (options C and D), but this would be produced by hypokalemia, not by hyperkalemia. There is no evidence that prolonged hyperkalemia decreases the number of Na+ channels in the membrane.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Antidromic conduction is seen in:-", "options": [{"label": "A", "text": "Axon", "correct": true}, {"label": "B", "text": "Synapse", "correct": false}, {"label": "C", "text": "Both", "correct": false}, {"label": "D", "text": "None", "correct": false}], "correct_answer": "A. Axon", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Axon Antidromic conduction is seen in Axon. An antidromic impulse in an axon refers to conduction opposite of the normal (orthodromic) direction.</p>\n<p><strong>Highyeild:</strong></p><p>An axon can conduct in either direction. When an action potential is initiated in the middle of it, two impulses traveling in opposite directions are set up by electrotonic depolarization on either side of the initial current sink. In the natural situation, impulses pass in one direction only, i.e., from synaptic junctions or receptors along axons to their termination. Such conduction is called orthodromic. Conduction in the opposite direction is called antidromic. Because synapses, unlike axons, permit conduction in one direction only, an antidromic impulse will fail to pass the first synapse they encounter and die out at that point. The apparatus for protein synthesis in neurons are located primarily in the soma, with the transport of proteins and polypeptides to the axonal ending by the axoplasmic flow. Thus, the cell body maintains the functional and anatomic integrity of the axon. Orthograde transport occurs along microtubules located along the length of the axon; it requires two molecular motors, dynein, and kinesin. Orthograde transport moves from the cell body toward the axon terminals. It has both fast and slow components, fast axonal transport occurs at about 400 mm/day, and slow axonal transport occurs at 0.5–10 mm/day. Retrograde transport from the nerve ending to the cell body occurs at about 200 mm/day.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. Synapse permits conduction in one direction only.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The permeability to which of the following ions increases during the depolarization of a nerve fiber:", "options": [{"label": "A", "text": "Ca++", "correct": false}, {"label": "B", "text": "Cl-", "correct": false}, {"label": "C", "text": "Na+", "correct": true}, {"label": "D", "text": "Mg++", "correct": false}], "correct_answer": "C. Na+", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Na+ The ion permeability that increases during the depolarization of a nerve fiber is primarily the permeability to sodium ions (Na+). Depolarization Stage. At this time, the membrane suddenly becomes permeable to sodium ions, allowing tremendous numbers of positively charged sodium ions to diffuse to the interior of the axon. The normal “polarized” state of −90 millivolts is immediately neutralized by the inflowing positively charged sodium ions, with the potential rising rapidly in the positive direction—a process called depolarization. In large nerve fibers, the great excess of positive Na+ moving to the inside causes the membrane potential to actually “overshoot”.</p>\n<p><strong>Highyeild:</strong></p><p>An action potential is generated when membrane depolarization reaches a level at which voltage-gated Na+ channels open, increasing PNa (or, in electrical terms, gNa), which results in an inward current of Na+, which causes further depolarization, opening additional Na+ channels in a positive feedback cycle. Inactivation of Na+ channels during an action potential prevents subsequent action potential initiation during the brief absolute refractory period, whereas the relative refractory period continues shortly thereafter because the delayed rectifier K+ channels remain open for a somewhat longer period.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- The permeability to calcium ions (Ca++) and magnesium ions (Mg++) generally remains relatively constant during the depolarization of a nerve fiber. The permeability to chloride ions (Cl-) can also change, but this usually happens later in the action potential and plays a role in repolarization rather than depolarization.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The resting membrane potential of the nerve is determined by the concentration of:", "options": [{"label": "A", "text": "Calcium", "correct": false}, {"label": "B", "text": "Potassium", "correct": true}, {"label": "C", "text": "Chloride", "correct": false}, {"label": "D", "text": "Magnesium", "correct": false}], "correct_answer": "B. Potassium", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Potassium The resting membrane potential of a nerve is primarily determined by the concentration gradient of potassium ions (K+) inside and outside the cell. In neurons, the concentration of K+ is much higher inside than outside the cell, while the reverse is the case for Na+. The outward K+ concentration gradient results in the passive movement of K+ out of the cell when K+ -selective channels are open. Similarly, the inward Na+ concentration gradient results in the passive movement of Na+ into the cell when Na+-selective channels are open.</p>\n<p><strong>Highyeild:</strong></p><p>Because there are more open K+ channels than Na+ channels at rest, the membrane permeability to K+ Is greater. Consequently, the intracellular and extracellular K+ concentrations are the prime determinants of the resting membrane potential, which is therefore close to the equilibrium potential for K+.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- While other ions such as sodium (Na+), chloride (Cl-), and calcium (Ca++) also play important roles in nerve function, they do not primarily determine the resting membrane potential.</p>\n<p><strong>Extraedge:</strong></p><p>What is an action potential? An action potential is a rapid rise and subsequent fall in voltage or membrane potential across a cellular membrane with a characteristic pattern. The stimulus starts the rapid change in voltage or action potential. In patch-clamp mode, sufficient current must be administered to the cell to raise the voltage above the threshold voltage to start membrane depolarization. Depolarization is caused by a rapid rise in membrane potential opening of sodium channels in the cellular membrane, resulting in a large influx of sodium ions. Membrane Repolarization results from rapid sodium channel inactivation as well as a large efflux of potassium ions resulting from activated potassium channels. Hyperpolarization is a lowered membrane potential caused by the efflux of potassium ions and the closing of the potassium channels. The resting state is when membrane potential returns to the resting voltage that occurred before the stimulus occurred.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Due to the activation of ion channels of the external membrane of the excitable cell, its rest potential has significantly increased. What channels were activated?", "options": [{"label": "A", "text": "Fast calcium channels", "correct": false}, {"label": "B", "text": "Sodium and calcium channels", "correct": false}, {"label": "C", "text": "Potassium channels", "correct": true}, {"label": "D", "text": "Natrium channels", "correct": false}], "correct_answer": "C. Potassium channels", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Potassium channels The activation of ion channels on the external membrane of an excitable cell that results in a significant increase in the resting potential is most likely due to the opening of potassium (K+) channels. A negative overshoot called hyperpolarization occurs when potassium gates stay open longer than Na gates, so the amount of potassium that leaves the cell is greater than the amount of sodium that entered. Therefore, the membrane voltage drops to 1 or 2 mV more negatively than the original RMP (when RMP becomes more negative, it means that RMP increased). Therefore, the most likely scenario for a significant increase in the resting membrane potential is the activation of potassium channels.</p>\n<p><strong>Highyeild:</strong></p><p>The resting membrane potential of most excitable cells falls in the range of −70 to −80 mV. These values can best be explained by the concept of the relative permeabilities of the cell membrane. Thus the resting membrane potential is close to the equilibrium potentials for K+ and Cl− because the permeability to these ions at rest is high. The resting membrane potential is far from the equilibrium potentials for Na+ and Ca2+ because the permeability to these ions at rest is low.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Fast calcium channels and sodium (Na+) and calcium (Ca++) channels primarily mediate depolarization of the cell membrane, and the activation of these channels would lead to a decrease in the resting potential. The activation of sodium channels alone would also cause depolarization, not hyperpolarization.</p>\n<p><strong>Extraedge:</strong></p><p>What is an action potential? An action potential is a rapid rise and subsequent fall in voltage or membrane potential across a cellular membrane with a characteristic pattern. The stimulus starts the rapid change in voltage or action potential. In patch-clamp mode, sufficient current must be administered to the cell to raise the voltage above the threshold voltage to start membrane depolarization. Depolarization is caused by a rapid rise in membrane potential opening of sodium channels in the cellular membrane, resulting in a large influx of sodium ions. Membrane Repolarization results from rapid sodium channel inactivation as well as a large efflux of potassium ions resulting from activated potassium channels. Hyperpolarization is a lowered membrane potential caused by the efflux of potassium ions and the closing of the potassium channels. The resting state is when membrane potential returns to the resting voltage that occurred before the stimulus occurred.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 25 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "Which of the following is the principal metabolite in norepinephrine metabolism excreted in urine?", "options": [{"label": "A", "text": "Metanephrine", "correct": false}, {"label": "B", "text": "Homogentisic acid", "correct": false}, {"label": "C", "text": "Aspartic acid", "correct": false}, {"label": "D", "text": "Vanillylmandelic acid", "correct": true}], "correct_answer": "D. Vanillylmandelic acid", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Vanillylmandelic acid Levels of VMA are important in the diagnosis of adrenal pathologies.</p>\n<p><strong>Highyeild:</strong></p><p>Extracellular epinephrine and norepinephrine are for the most part O-methylated, and measurement of the concentrations of the O-methylated derivatives normetanephrine and metanephrine in the urine is a good index of the rate of secretion of norepinephrine and epinephrine. The O-methylated derivatives that are not excreted are largely oxidized, and 3-methoxy-4-hydroxy mandelic acid (vanillylmandelic acid, VMA) is the most plentiful catecholamine metabolite in the urine.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Measurement of plasma metanephrines or 24-h urinary metanephrines are the gold standard of diagnosis. Not only Metanephrines. Option B. Identification of vastly elevated levels of homogentisic acid in the urine is indicative of alkaptonuria. Alkaptonuria should be suspected in individuals with dark urine. Option C. Aspartic Acid (Urine) results are too high. It is sometimes seen in epilepsy and stroke. Magnesium and zinc may counteract high aspartic add levels.</p>\n<p><strong>Table:</strong></p><p>Catecholamine synthesis or Tyrosine\nCatabolism</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A patient suffering from pheochromocytoma complains of thirst, dry mouth, and hunger. A blood test for sugar revealed hyperglycemia. What type of hyperglycemia is this?", "options": [{"label": "A", "text": "Hyper Corticoid", "correct": false}, {"label": "B", "text": "Adrenal", "correct": true}, {"label": "C", "text": "Alimentary", "correct": false}, {"label": "D", "text": "Somatotropic", "correct": false}], "correct_answer": "B. Adrenal", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Adrenal Pheochromocytoma is a tumor of the adrenal medulla that secretes excessive amounts of epinephrine and norepinephrine. So, in the case of pheochromocytoma, there is adrenal hyperglycemia.</p>\n<p><strong>Highyeild:</strong></p><p>Pheochromocytoma classically presents with paroxysms of hypertension and adrenergic symptoms including a classic triad of episodic headache, sweating, and tachycardia. Metabolism of catecholamines takes place in the liver and kidneys by the formation of metabolites such as metanephrines, normetanephrine, and VMA, which may undergo further glucuronidation or sulfation before being excreted in the urine.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. An overproduction of corticosteroids can lead to Cushing's syndrome. Option C. Alimentary disease related to the digestive system . Option D. The somatotropic axis, essentially consisting of growth hormone (GH), insulin-like growth factors (IGF-I and -II), their associated carrier proteins, and receptors, plays a key role in the control of the regulation of metabolism and physiological processes.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Mineralocorticoids play a critical role in fluid and electrolyte balance in the body. A normal response to aldosterone is to increase acid secretion in the kidney. The hyperaldosteronism that occurs with some adrenal tumors have interesting and profound effects on acid-base balance as a result of increased renal H+ secretion. Which of the following would be the most likely result of hyperaldosteronism?", "options": [{"label": "A", "text": "Excretion of excess bicarbonate", "correct": false}, {"label": "B", "text": "Generation Of Metabolic Alkalosis", "correct": true}, {"label": "C", "text": "Hyperkalemia caused by renal K+ resorption", "correct": false}, {"label": "D", "text": "Increased H+ reabsorption by renal tubular cell", "correct": false}], "correct_answer": "B. Generation Of Metabolic Alkalosis", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Generation Of Metabolic Alkalosis Hyperaldosteronism leads to a loss of potassium and hypokalemia. Hypokalemia leads to a loss of potassium from cells largely in exchange for H+. This causes metabolic alkalosis and intracellular acidosis .</p>\n<p><strong>Highyeild:</strong></p><p>Adrenal glands have an outer cortical region that produces mineralocorticoids (aldosterone), glucocorticoids (cortisol), and androgenic hormones. The inner, medullary region of the adrenal gland is highly innervated and produces the circulating sympathetic hormones epinephrine and norepinephrine. The adrenocortical hormones are steroid hormones. The steroid hormones are permeable to the cell membrane; thus, their rate of secretion is dependent on their rate of production. Cortisol production is dependent on ACTH and in part is controlled by a negative feedback loop with cortisol-inhibiting ACTH production. In the present case, there is an increase in ACTH secretion that causes an overproduction of cortisol (Cushing syndrome). Adrenal hyperplasia also can cause the overproduction of cortisol. Understanding the mechanisms of action of the adrenocortical hormones has produced a number of novel therapies for the control of hypertension (ACE inhibitors), anti-inflammatories (COX 2 inhibitors), and immunosuppression (cortisol).</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: D. Renal tubular cells respond with an increase in the rate of H+ secretion. Option: A. Paradoxically, despite the metabolic alkalosis, there is an increased rate of H+ secretion and bicarbonate reabsorption with the addition of bicarbonate to the blood. There is increased reabsorption of bicarbonate and maintenance of metabolic alkalosis. Option: C. hypokalemia leads to a loss of potassium from cells largely in exchange for H+ .</p>\n<p><strong>Extraedge:</strong></p><p>The Physiology of Mineralocorticoids The mineralocorticoids, primarily aldosterone, are essential for the maintenance of salt and water balance by the kidney by regulating sodium reabsorption and potassium secretion. Aldosterone is produced in the zona glomerulosa from the common pregnenolone precursor. Regulation of aldosterone secretion is dependent on several factors. ACTH-dependent pregnenolone synthesis is required for maximal aldosterone production, but secretion is controlled directly by angiotensin II and the extracellular ([K+]) potassium concentration. Increasing plasma [K+] stimulates aldosterone secre- tion. Atrial natriuretic factor has a negative modulatory effect on aldosterone secretion. As with the other adrenal cortical hormones, aldosterone binds to and is carried in the blood by corticosteroid-binding globulin (CBG). The physiologic role of aldosterone is the maintenance of fluid and electrolyte balance, and its secretion is tightly coupled to the vascular volume. A decrease in vascular volume initiates a cascade response with an increase in renal renin secretion from smooth muscle cells of the afferent glomerular arteriole. Renin catalyzes the conversion of angiotensinogen to angiotensin I. Angiotensin-converting enzyme (ACE) converts angiotensin I to angiotensin II. The target of angiotensin II is the zona glomerulosa, which responds by increasing the production and secretion of aldosterone.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Adrenalectomized animals are unable to survive even brief periods of food deprivation. Cortisol replacement restores the ability to survive fast. Which of the following is the best explanation for this observation?", "options": [{"label": "A", "text": "Cortisol can act synergistically with insulin", "correct": false}, {"label": "B", "text": "Cortisol can act antagonistically to the action of growth hormone", "correct": false}, {"label": "C", "text": "Cortisol has a permissive effect on enzymes involved in the mobilization of various fuels", "correct": true}, {"label": "D", "text": "Cortisol increases glucose utilization and decreases glycogen storage", "correct": false}], "correct_answer": "C. Cortisol has a permissive effect on enzymes involved in the mobilization of various fuels", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Cortisol has a permissive effect on enzymes involved in the mobilization of various fuels Cortisol increases proteolysis and induces the transaminases necessary to convert pyruvate into alanine for transport to the liver for gluconeogenesis.</p>\n<p><strong>Highyeild:</strong></p><p>Cortisol is essential for the expression of numerous enzymes involved in the maintenance of fuel supplies in preparation for and during a fast. At each stage of metabolism, enzymes have been identified as cortisol-dependent, beginning with the generation of glucogenic precursors. Muscle protein catabolism is an essential source of carbohydrate precursors. Key enzymes in the gluconeogenic pathway ranging from pyruvate to glycogen and those involved in the release of glucose from the liver are all known to be inducible by cortisol. Thus, one of its main functions is the continued production of glucose for metabolism by glucose-dependent tissues during a fast. Glucose utilization by tissues that can utilize alternative fuels is reduced by cortisol, which antagonizes insulin-dependent processes. To provide the energy necessary for gluconeogenesis, cortisol enhances triglyceride breakdown and free fatty acid mobilization from fat stores.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. cortisol, which antagonizes insulin-dependent processes . Option: B. Cortisol can act synergistically with the action of growth hormone. Option: D. Cortisol acts synergistically with glucagon to enhance hepatic gluconeogenesis.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 14 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "You are a medical student and today your examination scheme came. You decided to go to the library today. While going to the library you were carrying a stack of books. On the way, your friend saw you and placed another large book on top of the stack. Which of the following best describes how the skeletal muscle compensates for the increase in the load being carried?", "options": [{"label": "A", "text": "Decrease muscle length below the resting length", "correct": false}, {"label": "B", "text": "Increase muscle length beyond the resting length", "correct": false}, {"label": "C", "text": "Increase the number of motor units activated", "correct": true}, {"label": "D", "text": "None of the above", "correct": false}], "correct_answer": "C. Increase the number of motor units activated", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Increase the number of motor units activated As a greater force of contraction is required so more motor units should be activated to produce enough force of contraction. So the correct answer is C.</p>\n<p><strong>Random:</strong></p><p>Explanation for incorrect Options: The resting length for skeletal muscle is at the peak of the force tension curve, so changing skeletal muscle length above or below resting length results in moving down the curve. A less forceful contraction is produced that is less effective to support a heavier load. So options B and C are false.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The motion of the endolymph in the semicircular canals when the head is held still will result in the perception of :", "options": [{"label": "A", "text": "Being upside-down", "correct": false}, {"label": "B", "text": "Moving in a straight line", "correct": false}, {"label": "C", "text": "Continued rotation", "correct": true}, {"label": "D", "text": "Being upright and stationary", "correct": false}], "correct_answer": "C. Continued rotation", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Continued rotation Rotational acceleration in the plane of a given semicircular canal stimulates its crista. The endolymph , because of its inertia, is displaced in a direction opposite to the direction of rotation.</p>\n<p><strong>Highyeild:</strong></p><p>The fluid pushes on the cupula , deforming it. This bends the processes of the hair cells. When a constant speed of rotation is reached, the fluid spins at the same rate as the body, and the cupula swings back into the upright position. When rotation is stopped, deceleration produces a displacement of the endolymph in the direction of the rotation, and the cupula is deformed in a direction opposite to that during acceleration. Rotation causes maximal stimulation of the semicircular canals most nearly in the plane of rotation. Because the canals on one side of the head are a mirror image of those on the other side, the endolymph is displaced toward the ampulla on one side and away from it on the other. The pattern of stimulation reaching the brain, therefore, varies with the direction as well as the plane of rotation. Linear acceleration probably fails to displace the cupula and therefore does not stimulate the cristae.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest all options are incorrect because Rotation causes maximal stimulation of the semicircular canals most nearly in the plane of rotation.</p>\n<p><strong>Extraedge:</strong></p><p>The utricular and saccular macula respond to horizontal and vertical acceleration, respectively. The otoliths in the surrounding membrane are denser than the endolymph, and acceleration in any direction causes them to be displaced in the opposite direction, distorting the hair cell processes and generating activity in the vestibular The maculae also discharge in the absence of head movement due to the pull of gravity on the otoliths. The impulses generated from these receptors are partly responsible for labyrinthine righting reflexes. The reflex is initiated by tilting the head which stimulates the otolithic organs; the response is a compensatory contraction of the neck muscles to keep the head level. A vestibulo -ocular reflex stabilizes images on the retina during head movements. Vestibular stimulation during the rotation leads to the inhibition of extraocular muscles on one side and activation of the extraocular muscles on the other side. Although most of the responses to stimulation of the maculae are reflex in nature, vestibular impulses also reach the cerebral cortex. These impulses may mediate conscious perception of motion and supply part of the information necessary for orientation in space. Vertigo is the sensation of rotation in the absence of actual rotation .</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following is a preganglionic sympathetic neurotransmitter?", "options": [{"label": "A", "text": "Glycine", "correct": false}, {"label": "B", "text": "Adrenaline", "correct": false}, {"label": "C", "text": "Norepinephrine", "correct": false}, {"label": "D", "text": "Acetylcholine", "correct": true}], "correct_answer": "D. Acetylcholine", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Acetylcholine The preganglionic neurotransmitter is acetylcholine (nicotinic) and the postganglionic neurotransmitter (at effector organs) is noradrenaline (norepinephrine), except at sweat glands (muscarinic acetylcholine).</p>\n<p><strong>Highyeild:</strong></p><p>Acetylcholine is secreted by neurons in many areas of the nervous system but specifically by The terminals of the large pyramidal cells from the motor cortex , Several different types of neurons in the basal ganglia , The motor neurons that innervate the skeletal muscles, The preganglionic neurons of the autonomic nervous system , The postganglionic neurons of the parasympathetic nervous system, and Some of the postganglionic neurons of the sympathetic nervous system. In most instances, acetylcholine has an excitatory effect; however, it is known to have inhibitory effects at some peripheral parasympathetic nerve endings, such as inhibition of the heart by the vagus nerves.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Glycine is an inhibitory neurotransmitter in the CNS, especially in the spinal cord and brainstem. Glycine is released from the Renshaw cell as an inhibitory neurotransmitter in the anterior horn of the spinal cord. Option: B. Epinephrine , also known as adrenaline, is both a neurotransmitter and a hormone. Postganglionic neurons of the sympathetic nervous system use norepinephrine and epinephrine. Option: C. Norepinephrine is a neurotransmitter of the ANS that is present only in postsynaptic sympathetic fibers.</p>\n<p><strong>Extraedge:</strong></p><p>The two main neurotransmitters in the ANS are acetylcholine and norepinephrine. The fibers that release acetylcholine are called cholinergic, and the fibers that release norepinephrine are called adrenergic. All the preganglionic fibers are cholinergic, both in the sympathetic and parasympathetic portions of the ANS. Almost all postganglionic parasympathetic fibers are also cholinergic. In contrast, most postganglionic sympathetic fibers are adrenergic. An exception among sympathetic fibers comprise those fibers that innervate sweat glands and piloerector muscles – these are cholinergic.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The precentral gyrus and corticospinal tract are essential for which of the following?", "options": [{"label": "A", "text": "Vision", "correct": false}, {"label": "B", "text": "Olfaction", "correct": false}, {"label": "C", "text": "Auditory identification", "correct": false}, {"label": "D", "text": "Voluntary movement", "correct": true}], "correct_answer": "D. Voluntary movement", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Voluntary movement These structures are essential for the generation of fine voluntary movements.</p>\n<p><strong>Highyeild:</strong></p><p>The precentral gyrus is the motor area of the cortex that contains the cell bodies of the neurons that form the corticospinal tract (also referred to as the pyramidal tract). The corticospinal tract contains axons that cross to the contralateral side of the brain within the pyramids and end within the motor areas of the spinal cord. These structures are essential for the generation of fine voluntary movements. Kinesthesia, the sense of movement and position of the limbs, is handled primarily by the IA and IB afferents that innervate the muscle spindles and Golgi tendon organs, respectively, and by the parietal lobe.</p>\n<p><strong>Extraedge:</strong></p><p>The primary motor cortex is in the precentral gyrus of the frontal lobe, extending into the central sulcus. Using stimulation experiments in patients undergoing craniotomy under local anesthesia, this region was mapped to show where various parts of the body are represented in the precentral gyrus showing the motor homunculus with the feet at the top of the gyrus and the face at the bottom. Representation of each body part is proportional in size to the skill with which the part is used in fine, voluntary movement. The areas involved in speech and hand movements are especially large in the cortex; the use of the pharynx, lips, and tongue to form words and of the fingers and opposable thumbs to manipulate the environment are activities in which humans are especially skilled. The supplementary motor area is on and above the superior bank of the cingulate sulcus on the medial side of the hemisphere. It projects to M1 and contains a map of the body, but it is less precise than in M1. The supplementary motor area is involved in organizing or planning motor sequences, while M1 executes the movements. When human subjects count to themselves without speaking, the motor cortex is quiescent, but when they speak the numbers aloud as they count, blood flow increases in M1 and the supplementary motor area. Thus, both regions are involved in voluntary movement when the movements being performed are complex and involve planning mbps to manipulate the environment are activities in which humans are especially skilled.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following is involved in amyotrophic lateral sclerosis?", "options": [{"label": "A", "text": "Raphae nucleus", "correct": false}, {"label": "B", "text": "Lower motor neuron", "correct": true}, {"label": "C", "text": "Posterior column", "correct": false}, {"label": "D", "text": "Anterior and posterior column", "correct": false}], "correct_answer": "B. Lower motor neuron", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Lower motor neuron An example of a disease that leads to lower motor neuron damage is amyotrophic lateral sclerosis (ALS).</p>\n<p><strong>Highyeild:</strong></p><p>Lower motor neurons are those whose axons terminate on skeletal muscles. Damage to these neurons is associated with flaccid paralysis, muscular atrophy, fasciculations (visible muscle twitches that appear as flickers under the skin), hypotonia (decreased muscle tone), and hyporeflexia or areflexia “Amyotrophic” means “no muscle nourishment” and describes the atrophy that muscles undergo because of disuse. “Sclerosis” refers to the hardness felt when a pathologist examines the spinal cord on autopsy; the hardness is due to the proliferation of astrocytes and scarring of the lateral columns of the spinal cord. ALS is a selective, progressive degeneration of α-motor neurons. This fatal disease is also known as Lou Gehrig's disease because Gehrig, a famous American baseball player, died of it. Mutation in the gene for Cu/Zn superoxide dismutase (SOD-1) on chromosome 21 is found in familial cases of ALS. SOD is a free radical scavenger that reduces oxidative stress. A defective SOD-1 gene permits free radicals to accumulate and kill neurons. An increase in the excitability of deep cerebellar nuclei due to the inhibition of small-conductance calcium-activated potassium (SK) channels may contribute to the development of cerebellar ataxia.</p>\n<p><strong>Extraedge:</strong></p><p>Riluzole is a drug that opens the SK channels and may be effective in preventing nerve damage caused by excessive release of the excitatory amino acid, glutamate. It is shown to moderately slow the progression of ALS. Spasticity associated with motor neuron disease can be reduced by the muscle relaxant baclofen (a derivative of GABA); in some cases, a subarachnoid infusion of baclofen is given via an implanted lumbar pump. Spasticity can also be treated with tizanidine, a centrally acting α2 -adrenoceptor agonist; its effectiveness is due to increasing presynaptic inhibition of spinal motor neurons. Botulinum toxin is also approved for the treatment of spasticity; this toxin acts by binding to receptors on the cholinergic nerve terminals to decrease the release of acetylcholine, causing neuromuscular blockade.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Non-shivering thermogenesis is mediated by:", "options": [{"label": "A", "text": "α1 receptor", "correct": false}, {"label": "B", "text": "β2 Receptor", "correct": false}, {"label": "C", "text": "β3 adrenergic receptor & UCP1", "correct": true}, {"label": "D", "text": "UCP-2", "correct": false}], "correct_answer": "C. β3 adrenergic receptor & UCP1", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>β3 adrenergic receptor & UCP1 Activation of either β(1)- adrenergic receptors or β(3)-adrenergic receptors were able to increase UCP1 mRNA and protein levels. Thus, in humans, β(1)-adrenergic receptors could play an important role in regulating nonshivering thermogenesis .</p>\n<p><strong>Highyeild:</strong></p><p>Brown fat cells also contain many mitochondria. In these mitochondria, an inward proton conductance that generates ATP takes place as usual, but in addition, there is a second proton conductance that does not generate ATP. This “short circuit” conductance depends on a 32-kDa uncoupling protein (UCP1). It causes the uncoupling of metabolism and generation of ATP so that more heat is produced. An increase in either sympathetic stimulation or circulating norepinephrine and epinephrine in the blood can rapidly increase the rate of cellular metabolism. This effect is called chemical thermogenesis or nonshivering thermogenesis. It results at least partially from the ability of norepinephrine and epinephrine to uncouple oxidative phosphorylation, which means that excess foodstuffs are oxidized, and thereby, release energy in the form of heat but does not cause adenosine triphosphate to be formed. The degree of chemical thermogenesis that occurs in an animal is almost directly proportional to the amount of brown fat in the animal’s tissues. This type of fat contains large numbers of special mitochondria where uncoupled oxidation occurs. Brown fat is richly supplied with sympathetic nerves that release norepinephrine, which stimulates tissue expression of mitochondrial uncoupling protein (also called thermogenin) and increases thermogenesis.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 16 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "From which of the following parts marked from A to D, filtration of Na ions is minimum?", "options": [{"label": "A", "text": "A", "correct": false}, {"label": "B", "text": "B", "correct": true}, {"label": "C", "text": "C", "correct": false}, {"label": "D", "text": "D", "correct": false}], "correct_answer": "B. B", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683534453140-QTDY050001IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>B Option: B. Area B thin part of descending limb of Henle’s loop. Na is filtered in large amounts but is actively transported out of all the portions of the tubule except the descending thin limb of Henle’s Loop.</p>\n<p><strong>Highyeild:</strong></p><p>The thin descending limb has low permeability to ions and urea while being highly permeable to water. The loop has a sharp bend in the renal medulla going from descending to ascending thin limb. The thin ascending limb is impermeable to water, but it is permeable to ions.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Area marked B is a thick part of the descending limb of Henle’s loop . Na is filtered through here. Option: C . Area marked C is ascending Henle’s loop . Na is filtered through here. Option: D . Area marked D is the collecting duct. Na is filtered through here.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 67-year-old woman with osteoporosis is given a diuretic to treat her hypertension. This particular diuretic has the adverse effect of limiting calcium excretion by the kidney. Referring to the Image, where along the nephron does this drug act?", "options": [{"label": "A", "text": "A", "correct": false}, {"label": "B", "text": "B", "correct": false}, {"label": "C", "text": "C", "correct": false}, {"label": "D", "text": "D", "correct": true}], "correct_answer": "D. D", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683534453278-QTDY050002IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>D Loop diuretics inhibit the Na-K-2CI transporter and also increase calcium excretion. They are often used in the treatment of hypercalcemia. Thiazide diuretics block the Thiazide sensitive NaCI transporter in the distal convoluted tubule and can decrease Calcium excretion.</p>\n<p><strong>Highyeild:</strong></p><p>As the woman has osteoporosis, her bones are already weakened and more susceptible to fractures. Calcium is an essential nutrient for maintaining bone strength, so limiting calcium excretion by the kidney could have a positive effect on her bones. However, it is important to note the use of diuretics.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "What is the osmolarity at point X in the diagram below if ADH is present?", "options": [{"label": "A", "text": "Hypertonic", "correct": true}, {"label": "B", "text": "Hypotonic", "correct": false}, {"label": "C", "text": "Isotonic", "correct": false}, {"label": "D", "text": "Hypertonic if aldosterone is also present", "correct": false}], "correct_answer": "A. Hypertonic", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683534453542-QTDY050003IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Hypertonic Because one of its principal physiologic effects is the retention of water by the kidney, vasopressin is often called the antidiuretic hormone (ADH).</p>\n<p><strong>Highyeild:</strong></p><p>It increases the permeability of the collecting ducts of the kidney, so that water enters the hypertonic interstitium of the renal pyramids. The urine becomes concentrated, and its volume decreases. The overall effect is therefore retention of water in excess of the solute; consequently, the effective osmotic pressure of the body fluids is decreased. In the absence of vasopressin, the urine is hypotonic to plasma, urine volume is increased, and there is a net water loss. Consequently, the osmolality of the body fluid rises.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest options are incorrect.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "An infant of 3 months of age was taken to the nephrologist for symptoms of poor feeding, lethargy, and swelling in the body of the infant. Examination and tests revealed proteinuria, hypoalbuminemia, and generalized edema of the body. The infant was diagnosed with Congenital nephrotic syndrome. Select the incorrect?", "options": [{"label": "A", "text": "Impaired synthesis of nephrin", "correct": false}, {"label": "B", "text": "Mutation in the NPHS1 gene", "correct": false}, {"label": "C", "text": "Nephrin protein is essential for filtration slit working", "correct": false}, {"label": "D", "text": "All incorrect", "correct": true}], "correct_answer": "D. All incorrect", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>All incorrect Options A,B, and C are all correct In this case, the symptoms of poor feeding, lethargy, and swelling in the body of the infant are consistent with the diagnosis of congenital nephrotic syndrome. Proteinuria (the presence of protein in the urine) is an important diagnostic finding for this condition, as it indicates that the kidneys are not functioning properly.</p>\n<p><strong>Highyeild:</strong></p><p>Nephrin is a protein necessary for the proper functioning of the renal filtration barrier. The renal filtration barrier consists of fenestrated endothelial cells, the glomerular basement membrane, and the podocytes of epithelial cells. Nephrin is a transmembrane protein that is a structural component of the slit diaphragm. They are present on the tips of the podocytes as an intricate mesh and convey strong negative charges which repel protein from crossing into the Bowman's space. A defect in the gene for nephrin, NPHS1, is associated with congenital nephrotic syndrome of the Finnish type and causes massive amounts of protein to be leaked into the urine or proteinuria.</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Rest All options are correct because Hypoalbuminemia (low levels of albumin in the blood) can also occur in congenital nephrotic syndrome as a result of the loss of protein in the urine. This can lead to generalized edema (swelling in the body), as fluids build up in the tissues due to a decrease in the protein that normally helps keep fluids in the bloodstream.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A male patient at age 19 years was taken to a nephrologist with symptoms of frothy urine, loss of appetite, nausea, vomiting, and lethargy in the past 3 months. Examination and tests reported proteinuria, low serum albumin, low serum antibodies, high cholesterol, and Fatty casts in the urine. The image shows the presence of edema on the face and puffiness around the eyes. Select the correct:-", "options": [{"label": "A", "text": "Podocytes in Bowman's capsule prevent filtration of molecules larger than 5 nm", "correct": false}, {"label": "B", "text": "Presence of glomerular sclerosis", "correct": false}, {"label": "C", "text": "Mutation in NPHS2 gene", "correct": false}, {"label": "D", "text": "All correct", "correct": true}], "correct_answer": "D. All correct", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>All correct Options A, B, and C are all correct Focal segmental glomerulosclerosis (FSGS), also known as “focal glomerular sclerosis” or “focal nodular glomerulosclerosis,” is a histopathologic finding of scarring (sclerosis) of glomeruli and damage to renal podocytes.</p>\n<p><strong>Highyeild:</strong></p><p>This process damages the filtration function of the kidney, resulting in protein loss in the urine. FSGS is a leading cause of excess protein loss, nephrotic syndrome in children and adults. Signs and symptoms include proteinuria, water retention, and edema. Kidney failure is a common long-term complication of the Podocytes are specialized cells lining the Bowman's capsule that contribute to the filtration barrier, preventing molecules larger than 5 nm from being filtered. FSGS involves damage to the renal podocytes such that larger molecules, most notably proteins, are filtered and lost through the kidney. Thus, many of the signs and symptoms of FSGS are related to protein loss.</p>\n<p><strong>Random:</strong></p><p>Explanation for other Options:- Rest options are inappropriate</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A patient in 45 years came to consult a nephrologist who was suffering from diabetes mellitus for the past 12 years and was on insulin therapy. The patient narrated about lethargy, passing frothy urine, loss of appetite, nausea, vomiting, weight loss, and occasional giddiness past 8 months. Examination revealed the presence of urinary albumin excretion ≥300 mg/24h, HbA1C 8.5%. The patient was diagnosed with diabetic nephropathy. Select the incorrect?", "options": [{"label": "A", "text": "Expansion of mesangial matrix", "correct": false}, {"label": "B", "text": "Impaired functions of podocytes and endothelial cells", "correct": false}, {"label": "C", "text": "Reduced volume of mesangial matrix", "correct": true}, {"label": "D", "text": "Accumulation of extracellular matrix proteins in Bowman capsule", "correct": false}], "correct_answer": "C. Reduced volume of mesangial matrix", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Reduced volume of mesangial matrix The expansion of the mesangial matrix is one characteristic of diabetic nephropathy although it also involves other cells in interaction including podocytes and endothelial cells.</p>\n<p><strong>Highyeild:</strong></p><p>Mesangial expansion occurs due to increased deposition of extracellular matrix proteins, for example, fibronectin, into the mesangium. Accumulation of extracellular matrix proteins then occurs due to insufficient degradation by matrix metalloproteinases. Mesangial cells grown on advanced glycosylation end product-modified matrix proteins demonstrate increased production of fibronectin and a decrease in proliferation. These factors eventually lead to the thickening of the glomerular basement membrane, mesangial matrix expansion then glomerulosclerosis and fibrosis.</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option A. expansion of mesangial matrix. Option B. impaired functions of podocytes and endothelial cells. Option D. Accumulation of extracellular matrix proteins in Bowman capsule.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Person at age 62 years developed sudden watery diarrhea, abdominal cramps, nausea and vomiting the past 1 day. The patient was weak, and dehydrated when brought to the emergency ward of the hospital. Pulse rate 86/min, RR 19/min, temp 99.3oF, and lethargic. Examination tests were recommended. The patient was diagnosed with gastrointestinal sepsis. The treatment protocol was started including IM Gentamicin to manage Gram-negative infections. Within 2 days, the patient's condition improved, but urine output reduced to 500ml/day with the appearance of muddy casts in urine analysis. Select the correct?", "options": [{"label": "A", "text": "Damage to Proximal tubular epithelial cells by nephrotoxicity", "correct": false}, {"label": "B", "text": "Stoppage of gentamicin", "correct": false}, {"label": "C", "text": "ATN has a fair prognosis", "correct": false}, {"label": "D", "text": "All correct", "correct": true}], "correct_answer": "D. All correct", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>All correct Damage to proximal tubular epithelial cells by nephrotoxicity is the most likely explanation for the appearance of muddy casts in the patient's urine analysis. Gentamicin is known to have potential nephrotoxic effects, and prolonged use or high doses can lead to damage of the proximal tubular cells in the kidneys, resulting in muddy casts in urine.</p>\n<p><strong>Highyeild:</strong></p><p>Drug-induced nephrotoxicity is driven by multiple mechanisms, including altered glomerular hemodynamics, renal tubular cytotoxicity, inflammation, crystal nephropathy, and thrombotic microangiopathy. Although the functional proteins expressed by renal tubules that mediate drug sensitivity are well known. Renal tubular epithelial cells express a wide range of transporters, many of which are unique to specific segments of renal tubules. Consequently, drugs with an affinity for these transporters cause cell apoptosis or death in specific nephron fractions.</p>\n<p><strong>Random:</strong></p><p>Explanation for other Options:- Option A. Damage to Proximal tubular epithelial cells by nephrotoxicity is the most likely explanation for the appearance of muddy casts in the patient's urine analysis. Option B. Stoppage of gentamicin: Stopping gentamicin may be necessary if the patient's kidney function is further compromised. Option C. ATN has a fair prognosis: The prognosis of acute tubular necrosis (ATN) can have a good prognosis with appropriate intervention, as well as the promptness and effectiveness of treatment.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Within the nephron of the kidney, the ascending limb of the loop of Henle is a segment of the heterogenous loop of Henle downstream of the descending limb, after the sharp bend of the loop. This part of the renal tubule is divided into a thin and thick ascending limb Image clearly describes it. Select the incorrect?", "options": [{"label": "A", "text": "Direct continuation from the descending limb of the loop of Henle,", "correct": false}, {"label": "B", "text": "Indirect continuation from the descending limb of the loop of Henle", "correct": true}, {"label": "C", "text": "Parts of the ascending limb in the medulla and cortex are very similar.", "correct": false}, {"label": "D", "text": "The medullary ascending limb is largely impermeable to water", "correct": false}], "correct_answer": "B. Indirect continuation from the descending limb of the loop of Henle", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683534453924-QTDY050008IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Indirect continuation from the descending limb of the loop of Henle Options A, C, and D are correct The ascending limb of the loop of Henle is a direct continuation from the descending limb of the loop of Henle, and one of the structures in the nephron of the kidney. The ascending limb has a thin and thick segment. The ascending limb drains urine into the distal convoluted tubule.</p>\n<p><strong>Highyeild:</strong></p><p>The medullary ascending limb is largely impermeable to water . Sodium (Na+), potassium (K+), and chloride (Cl−) ions are reabsorbed by active transport. The predominant mechanism of active transport in this segment is through the Na+/K+/Cl− co-transporter NKCC2 as well as the sodium/hydrogen exchanger NHE3.</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option A. direct continuation from the descending limb of the loop of Henle, Option C. parts of the ascending limb in the medulla and cortex are very similar. Option D. medullary ascending limb is largely impermeable to water</p>\n<p><strong>Table:</strong></p><p>ELECTROLYTE LOW SERUM CONCENTRATION HIGH SERUM CONCENTRATION Sodium Nausea, malaise, stupor, coma,\n seizures Irritability, stupor, coma Potassium U waves and flattened T waves\n on ECG, arrhythmias, muscle cramps, spasm, weakness Wide QRS and peaked T waves on\n ECG, arrhythmias, muscle weakness Calcium Tetany, seizures, QT\n prolongation, twitching (eg, Chvostek sign), spasm (eg, Trousseau sign) Stones ( renal), bones (pain), groans (abdominal pain), thrones (↑\n urinary frequency), psychiatric overtones (anxiety, altered mental status) Magnesium Tetany, torsades de pointes,\n hypokalemia, hypocalcemia (when [Mg2+] < 1.0 mEq/L) + DTRS, lethargy, bradycardia,\n hypotension, cardiac arrest, hypocalcemia Phosphate Bone loss, osteomalacia\n (adults), rickets (children) Renal stones, metastatic\n calcifications, hypocalcemia</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Physiologists described parts of nephrons to the class of medical undergraduates. He narrated that the distal convoluted tubule (DCT) is a portion of the kidney nephron between the loop of Henle and the collecting tubule. It is partly responsible for the regulation of potassium, sodium, calcium, and pH. Select the incorrect?", "options": [{"label": "A", "text": "Cells of the DCT have a thiazide-sensitive Na-Cl cotransporter", "correct": false}, {"label": "B", "text": "Regulates pH by absorbing bicarbonate and secreting protons (H+) into the filtrate,", "correct": false}, {"label": "C", "text": "Basolateral surface has ATP-dependent Na/K antiporter pump", "correct": false}, {"label": "D", "text": "Incorrect C", "correct": true}], "correct_answer": "D. Incorrect C", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Incorrect C The incorrect statement is D. The basolateral surface of DCT cells has a Na/K ATPase pump, not a Na/K antiporter pump. The Na/K ATPase pump is responsible for pumping sodium ions out of the cell and potassium ions into the cell, which helps establish and maintain the electrochemical gradient necessary for proper kidney function.</p>\n<p><strong>Highyeild:</strong></p><p>Distal convoluted tubule (DCT) is a portion of the kidney nephron between the loop of Henle and the collecting tubule. On its apical surface (lumen side), cells of the DCT have a thiazide-sensitive Na-Cl cotransporter and are permeable to Ca, via the TRPV5 channel. On the basolateral surface (peritubular capillary side) there is an ATP-dependent Na/K antiporter pump, a secondary active Na/Ca transporter, and an ATP-dependent Ca transporter. On the basolateral surface, ATP dependent Na/K pump produces the gradient for Na to be absorbed from the apical surface via the Na/Cl symporter, and for Ca to be reclaimed into the blood by the Na/Ca basolateral antiporter. It regulates pH by absorbing bicarbonate and secreting protons (H+) into the filtrate, or by absorbing protons and secreting bicarbonate into the filtrate.</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option A. cells of the DCT have a thiazide-sensitive Na-Cl cotransporter Option B. regulates pH by absorbing bicarbonate and secreting protons (H+) into the filtrate, Option C. basolateral surface has ATP-dependent Na/K antiporter pump</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "It is a proven fact that vascular structures supplying the juxtamedullary nephrons also differ from those supplying the cortical nephrons. Select the incorrect statement ?", "options": [{"label": "A", "text": "In cortical nephrons, the presence of an extensive network of peritubular capillary", "correct": false}, {"label": "B", "text": "In juxtamedullary nephrons, long efferent arterioles extend from the glomeruli down into the outer medulla and then divide into specialized peritubular capillaries called vasa recta", "correct": false}, {"label": "C", "text": "Vasa recta return toward the cortex and empty into the cortical veins", "correct": false}, {"label": "D", "text": "Vasa recta return toward the medulla and empty into the medullary veins", "correct": true}], "correct_answer": "D. Vasa recta return toward the medulla and empty into the medullary veins", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Vasa recta return toward the medulla and empty into the medullary veins The incorrect statement is D. Vasa recta returns toward the medulla and empties into the medullary veins, not cortical veins. The vasa recta are specialized peritubular capillaries that run parallel to the loops of Henle and function to maintain the concentration gradient in the renal medulla.</p>\n<p><strong>Highyeild:</strong></p><p>The vascular structures supplying the juxtamedullary nephrons also differ from those supplying the cortical nephrons. For the cortical nephrons, the entire tubular system is surrounded by an extensive network of peritubular capillaries. For the juxtamedullary nephrons, long efferent arterioles extend from the glomeruli down into the outer medulla and then divide into specialized peritubular capillaries called vasa recta that extend downward into the medulla, lying side by side with the loops of Henle. Like the loops of Henle, the vasa recta returns toward the cortex and empties into the cortical veins. This specialized network of capillaries in the medulla plays an essential role in the formation of a concentrated urine</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option A. in cortical nephrons, the presence of an extensive network of peritubular capillary Option B. in juxtamedullary nephrons, long efferent arterioles extend from the glomeruli down into the outer medulla and then divide into specialized peritubular capillaries called vasa recta. Option C. vasa recta return toward the cortex and empty into the cortical veins</p>\n<p><strong>Table:</strong></p><p>Juxtaglomerular apparatus Consists of mesangial cells, JG cells (modified\n smooth muscle of afferent arteriole), and the macula densa (NaCl sensor\n located at the DCT). JG cells secrete renin in response to ↓ renal blood\n pressure and ↑ sympathetic tone (B). Macula densa cells sense + NaCl delivery\n to DCT trenin release → efferent arteriole vasoconstriction → ↑ GFR. JGA maintains GFR via renin-angiotensin-\n aldosterone system. B-blockers BP by CO and inhibiting B ₁ - receptors of the JGA → + renin release.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Diabetic nephropathy may be monitored by measuring two values: the amount of protein in the urine- proteinuria; and a blood test called the serum creatinine. The amount of proteinuria reflects the degree of damage to any still-functioning glomeruli. A patient at the age of 34 years suffering from chronic uncontrolled diabetes mellitus reported frothy urine, occasional blood in urine, and weakness. Select the correct?", "options": [{"label": "A", "text": "Constriction of the efferent arterioles", "correct": false}, {"label": "B", "text": "Dilation of afferent arterioles", "correct": false}, {"label": "C", "text": "Glomerular capillary hypertension", "correct": false}, {"label": "D", "text": "All correct", "correct": true}], "correct_answer": "D. All correct", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>All correct All options correct In diabetic nephropathy, prolonged high blood sugar levels can lead to damage of the glomeruli in the kidneys, resulting in glomerular capillary This occurs when the glomerular capillaries become damaged and lose their ability to filter blood properly, leading to an increase in pressure within the glomerulus. This can result in proteinuria and, in more advanced cases, hematuria.</p>\n<p><strong>Highyeild:</strong></p><p>Diabetic nephropathy, also known as diabetic kidney disease, is the chronic loss of kidney function occurring in those with diabetes mellitus. Diabetic nephropathy is the leading cause of chronic kidney disease (CKD) and end-stage renal disease (ESRD) globally. The triad of protein leaking into the urine (proteinuria or albuminuria), rising blood pressure with hypertension and then falling renal function is common to many forms of CKD. Initially, there is constriction of the efferent arterioles and dilation of afferent arterioles, with resulting glomerular capillary hypertension and hyperfiltration particularly as nephrons become obsolescent and the adaption of hyperfiltration paradoxically causes further shear stress-related damage to the delicate glomerular capillaries further proteinuria, rising blood pressure and a vicious circle of additional nephron damage and decline in overall renal function.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest options are inappropriate</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A female patient at the age of 42 years came to the hospital with vomiting, loss of appetite, and swelling on her feet in the past 4 months. Absence of H/O oliguria, dysuria, or haematuria. H/O fever and drug allergy were ruled out. Lab tests revealed the presence of plasma creatinine 7 mg/100ml, blood urea 170 mg/100ml, serum sodium 138 mmol/L, and serum potassium 4.4 mmol/L. Urine analysis reported trace proteins and the absence of RBC in urine. Computed tomography reported changed echotexture in the renal cortices without any change in medullary pyramids. The patient was diagnosed with glomerulocystic disease. Select the incorrect?", "options": [{"label": "A", "text": "The cavity of the Bowman capsule enlarged", "correct": false}, {"label": "B", "text": "Size of glomeruli is abnormally large", "correct": true}, {"label": "C", "text": "Stenosis at glomerulotubular junction", "correct": false}, {"label": "D", "text": "A radiographic study reveals the presence of cysts in tubules", "correct": false}], "correct_answer": "B. Size of glomeruli is abnormally large", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Size of glomeruli is abnormally large The appearance of the cysts in glomerulocystic disease is like any other cyst in the body. However, the cortical distribution will aid in the diagnosis Histopathology typically shows normal-sized glomeruli with the enlarged Bowman’s space and tubular cystic changes. A proposed mechanism of glomerular cyst development is stenosis at the glomerulotubular junction but the exact mechanism is still unknown.</p>\n<p><strong>Highyeild:</strong></p><p>Glomerulotubular Junctional stenosis results in the proliferation of epithelial cells of the Bowman’s capsule, but recent studies are contradictory. This is associated with the remodeling of the basement membrane of the Bowman’s capsule. Some cases are thought to be due to urinary tract obstruction.</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option A. cavity of Bowman capsule enlarged Option C. stenosis at glomerulotubular junction Option D. radiographic study reveals the presence of cysts in tubules</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The patient, at the age of 16 years was taken to a nephrologist. His parents narrated complaints of polyuria, polydipsia, cramps in his legs, occasional vomiting, and poor growth in comparison to his peers. A family history of nephrocalcinosis and a detailed personal history rule out the possibility of surreptitious vomiting and diuretic abuse. Examination and tests performed. The patient was emaciated with a prominent forehead, large eyes, strabismus, protruding ears, sensorineural deafness, and drooping mouth. Lab tests reported the presence of hypokalemia, increased plasma renin, increased plasma aldosterone, and metabolic alkalosis. Select the incorrect?", "options": [{"label": "A", "text": "Renal tubular salt-wasting disorder", "correct": false}, {"label": "B", "text": "Thick ascending limb of the loop of Henle unable to reabsorb sodium and chloride in the", "correct": false}, {"label": "C", "text": "Increased excretion of salt and water loss from the body, activation of the renin-angiotensin-aldosterone system (RAAS)", "correct": false}, {"label": "D", "text": "Only C correct", "correct": true}], "correct_answer": "D. Only C correct", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Only C correct The incorrect statement is D. Only C is correct. The presentation and laboratory findings described suggest the patient is suffering from Bartter syndrome, which is a rare autosomal recessive renal tubular salt-wasting disorder.</p>\n<p><strong>Highyeild:</strong></p><p>This disorder is caused by a genetic mutation that affects the thick ascending limb of the loop of Henle, resulting in impaired reabsorption of sodium and chloride. This leads to increased excretion of salt and water from the body, which activates the renin-angiotensin-aldosterone system (RAAS), resulting in increased plasma renin and aldosterone levels, and subsequent hypokalemia and metabolic alkalosis.</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option A. renal tubular salt-wasting disorder Option B. thick ascending limb of the loop of Henle unable to reabsorb sodium and chloride in the renin-angiotensin-aldosterone system (RAAS) Option C. increased excretion of salt and water loss from the body, activation of the renin-angiotensin-aldosterone system (RAAS) Therefore, A, B, and C are correct statements.</p>\n<p><strong>Extraedge:</strong></p><p>Manifestations belonging to Bartter syndrome is a renal tubular salt-wasting disorder. Bartter syndrome is a renal tubular salt-wasting disorder in which the kidneys cannot reabsorb sodium and chloride in the thick ascending limb of the loop of Henle. This leads to increased distal delivery of salt and excessive salt and water loss from the body. The resultant volume depletion causes activation of the renin-angiotensin-aldosterone system (RAAS) and subsequent secondary hyperaldosteronism. Long-term stimulation causes hyperplasia of the juxtaglomerular apparatus and hence increased renin levels.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A child at age 15 months was taken to the hospital with symptoms of failure to thrive, sensitivity to sunlight, uncontrolled gait, tremor occasional, and involuntary eye movement over several months. H/O of the patient revealed the presence of occasional diarrhea over the past 8 months. Skin revealed signs of rash on the face, and legs. Urine chromatography reported the presence of increased levels of phenylalanine, leucine, asparagine, tyrosine, and tryptophan. Urinary excretion of proline, hydroxyproline, and arginine were spared in the analysis. Select the incorrect?", "options": [{"label": "A", "text": "Impaired absorption of tryptophan in intestine", "correct": false}, {"label": "B", "text": "Increased excretion of tryptophan in kidneys", "correct": false}, {"label": "C", "text": "Low plasma levels of nicotinamide", "correct": false}, {"label": "D", "text": "All correct", "correct": true}], "correct_answer": "D. All correct", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>All correct The symptoms and urinary excretion pattern are consistent with a diagnosis of Hartnup disease, which is a rare genetic disorder characterized by impaired absorption and increased renal excretion of neutral amino acids including tryptophan, resulting in a variety of neurological and skin manifestations.</p>\n<p><strong>Highyeild:</strong></p><p>Hartnup disease is an autosomal recessive metabolic disorder affecting the absorption of nonpolar amino acids (particularly tryptophan) and impaired excretion of tryptophan by kidneys. Hartnup disease is a disorder of amino acid transport in the intestine and kidneys; otherwise, the intestine and kidneys function normally, and the effects of the disease occur mainly in the brain and skin. Symptoms may begin in infancy or early childhood, but sometimes they begin as late as early adulthood. Symptoms may be triggered by sunlight, fever, drugs, or emotional or physical stress. A period of poor nutrition nearly always precedes an attack. The attacks usually become progressively less frequent with age. Most symptoms occur sporadically and are caused by a deficiency of niacinamide. A rash develops on parts of the body exposed to the sun. Mental retardation, short stature, headaches, unsteady gait, and collapsing or fainting are common. Psychiatric problems (such as anxiety, rapid mood changes, delusions, and hallucinations) may also result.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "True about nephron is ______", "options": [{"label": "A", "text": "Na is absorbed actively in descending loop of Henle", "correct": false}, {"label": "B", "text": "60 to 70% of GFR is absorbed in the proximal tubule", "correct": true}, {"label": "C", "text": "Absorption of water occurs in ascending loop of Henle", "correct": false}, {"label": "D", "text": "The filtrate reaching the distal convoluted tubule is hypertonic with respect to the surroundings", "correct": false}], "correct_answer": "B. 60 to 70% of GFR is absorbed in the proximal tubule", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>60 to 70% of GFR is absorbed in the proximal tubule 60 to 70% of GFR is absorbed in the proximal tubule- Normally, about 65 percent of the filtered load of sodium and water and a slightly lower percentage of filtered chloride are reabsorbed by the proximal tubule before the filtrate reaches the loops of Henle. These percentages can be increased or decreased in different physiological conditions.</p>\n<p><strong>Highyeild:</strong></p><p>As fluid flows down the descending loop of Henle, water is absorbed into the medulla. The descending limb also contains AQP-1 and is highly permeable to water but much less permeable to sodium chloride and urea. Therefore, the osmolarity of the fluid flowing through the descending loop gradually increases until it is nearly equal to that of the surrounding interstitial fluid</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A . Na is absorbed actively in descending loop of Henle- In the proximal tubules, the thick portion of the ascending limb of the loop of Henle, the distal tubules, and the collecting ducts, Na+ moves by cotransport or exchange from the tubular lumen into the tubular epithelial cells down its concentration and electrical gradients and is then actively pumped from these cells into the interstitial space. Option: C. Absorption of water occurs in ascending loop of Henle Option: D. The filtrate reaching the distal convoluted tubule is hypertonic with respect to the</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A hypertensive patient was prescribed the diuretic Lasix (furosemide) to increase urinary output. Furosemide, a “high-ceiling” diuretic, is a potent agent because it binds to and inhibits which of the following transport processes?", "options": [{"label": "A", "text": "The Na+-glucose cotransporter in the proximal tubule", "correct": false}, {"label": "B", "text": "The Na+-K+ exchange pump in all nephron segments", "correct": false}, {"label": "C", "text": "The Na+-K+-Cl− cotransporter in the thick ascending limb", "correct": true}, {"label": "D", "text": "The Na+-Cl− cotransporter in the distal convoluted tubule", "correct": false}], "correct_answer": "C. The Na+-K+-Cl− cotransporter in the thick ascending limb", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The Na+-K+-Cl− cotransporter in the thick ascending limb Furosemide inhibits the Na+-K+-Cl− cotransporter in the thick ascending limb. This is a critical transporter for the reabsorption of NaCl from the thick ascending limb into the medullary interstitium.</p>\n<p><strong>Highyeild:</strong></p><p>This transport of NaCl is the driving force behind the establishment of the hypertonicity of the medullary interstitium that is essential for the reabsorption of water from the collecting ducts and the generation of concentrated urine. Inhibition of the thick ascending limb cotransporter will lead to both a greater load of NaCl left behind in the tubular fluid, increasing urinary NaCl levels and a reduced hypertonicity of the medullary interstitium (less NaCl), decreasing the gradient for water reabsorption from the collecting ducts. This leads to a rapid and sustained increase in urinary volume flow along with significant urinary levels of NaCl. Hence, furosemide is a potent diuretic.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest options are incorrect because of the Na+-K+-Cl− cotransporter in the thick ascending limb.</p>\n<p><strong>Extraedge:</strong></p><p>Reabsorption of NaCl by the thick ascending limb underlies the generation of a medullary interstitial hypertonicity necessary for the passive reabsorption of water from the medullary collecting ducts. Loop diuretics are potent diuretics that inhibit the Na+-K+-Cl− cotransporter at the luminal membrane of the thick ascending limb , thereby inhibiting NaCl reabsorption by this segment and water reabsorption by the medullary collecting ducts. They often are called high-ceiling diuretics. Potassium-sparing diuretics such as amiloride and spironolactone inhibit Na+ reabsorption and, in turn, K+ secretion by the late distal tubule and collecting ducts. Aldosterone induces the synthesis of a myriad of new proteins in the late distal tubule and cortical collecting duct, including the synthesis of new Na+ channels and Na+ pumps. Administration of loop diuretics or other “upstream” diuretics can lead to increased tubular fluid flow to the late distal tubule and collecting ducts which, in turn, may stimulate K+ secretion and the development of hypokalemia.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 26 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "Fiber type Aα is a type of afferent nerve fiber and serves as the sensory fiber of muscle spindle found in muscles. These specific features were described by a physiologist. Select the irrelevant descriptions given:", "options": [{"label": "A", "text": "Diameter of fiber 12-20 (µm)", "correct": false}, {"label": "B", "text": "Conduction velocity 70-120 m/s", "correct": false}, {"label": "C", "text": "Nociceptors", "correct": true}, {"label": "D", "text": "Primary receptors of muscle spindle", "correct": false}], "correct_answer": "C. Nociceptors", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Nociceptors Nociceptors have two different types of axons. The first is the Aδ fiber axons. They are myelinated and can allow an action potential to travel at a rate of about 20 meters/second toward the CNS. The other type is the more slowly conducting C fiber axons.</p>\n<p><strong>Highyeild:</strong></p><p>Fiber type Aα is a type of afferent nerve fiber and serves as the sensory fiber of muscle spindle found in muscles. These serve as Proprioceptors Fiber type Aα (type Ia sensory fiber) is a type of afferent nerve fiber. It is the sensory fiber of a stretch receptor called the muscle spindle found in muscles, which constantly monitors the rate at which a muscle stretch changes. The information carried by type Ia fibers contributes to the sense of proprioception.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Fiber type Aα has a diameter of 12-20 (µm). Option B. Fiber type Aα has a conduction velocity of 70-120 m/s. Option D. These are Primary receptors of the muscle spindle.</p>\n<p><strong>Extraedge:</strong></p><p>Four types of sensory neurons and their receptor cells. Nociceptors are shown as free nerve endings type A. Somatic senses: touch, proprioception, pain, temperature Types of somatosensory fibers Non-myelinated fibers (type C): slowest; sense burning pain, hot temperature Small myelinated fibers (type Ad): faster; sense sharp pain, gross touch, cold temperatur Large myelinated fibers (type A-a; A-ẞ): fastest; sense proprioception, vibration, fine touch</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Physiologists divided the nerve fibers into specific groups based on the ‘General Classification’ of nerve fibers. Select the incorrect characteristic of nerve fibers in different groups:", "options": [{"label": "A", "text": "Type C fibers are small unmyelinated nerve fibers that conduct impulses at low velocities.", "correct": false}, {"label": "B", "text": "Type A fibers are the typically large and medium-sized myelinated fibers of spinal nerves.", "correct": false}, {"label": "C", "text": "Type A fibers are further subdivided into α, β, and δ fibers.", "correct": true}, {"label": "D", "text": "Subset of type A fibers has conduction velocity between 70-120 m/s.", "correct": false}], "correct_answer": "C. Type A fibers are further subdivided into α, β, and δ fibers.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Type A fibers are further subdivided into α, β, and δ fibers. Subsets of type A fibers are α, β, γ, and δ fibers.</p>\n<p><strong>Highyeild:</strong></p><p>In the “general classification” of nerve fibers, the fibers are divided into types A and C; the type A fibers are further subdivided into α, β, γ, and δ fibers. Type A fibers are the typically large and medium-sized myelinated fibers of spinal nerves. Type C fibers are small unmyelinated nerve fibers that conduct impulses at low velocities. The C fibers constitute more than half of the sensory fibers in most peripheral nerves, as well as all the postganglionic autonomic fibers.</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option A. Type C fibers are small unmyelinated nerve fibers that conduct impulses at low velocities. Option B. Type A fibers are the typically large and medium-sized myelinated fibers of spinal nerves. Option D. Subsets of type A fibers have conduction velocities between 70-120 m/s.</p>\n<p><strong>Extraedge:</strong></p><p>Four types of sensory neurons and their receptor cells. Nociceptors are shown as free nerve endings type A. Somatic senses: touch, proprioception, pain, temperature Types of somatosensory fibers Non-myelinated fibers (type C): slowest; sense burning pain, hot temperature Small myelinated fibers (type Ad): faster; sense sharp pain, gross touch, cold temperature Large myelinated fibers (type A-a; A-ẞ): fastest; sense proprioception, vibration, fine touch</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A patient at the age of 36 years presented with severe toothache and swelling in the right left side of the face about the upper 1st molar tooth for the past 4 days. The dentist advised immediate abscess drainage under local anesthetic infiltration. The dentist injected 2% lignocaine in the mucosa and operated on the tooth. Select the irrelevant statements:", "options": [{"label": "A", "text": "Type A fibers are most sensitive to the effect of local anesthetics.", "correct": true}, {"label": "B", "text": "Type A fibers are the least sensitive to the effect of local anesthetics.", "correct": false}, {"label": "C", "text": "Type C fibers are most sensitive to the effect of local anesthetics.", "correct": false}, {"label": "D", "text": "Type B fibers have intermediate sensitivity to the effect of local anesthetics.", "correct": false}], "correct_answer": "A. Type A fibers are most sensitive to the effect of local anesthetics.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Type A fibers are most sensitive to the effect of local anesthetics. Type A fibers are not the most sensitive to the effect of local anesthetics but exhibit the least sensitivity.</p>\n<p><strong>Highyeild:</strong></p><p>The greater the diameter of a given nerve fiber, the greater its speed of conduction. In addition to variations in the speed of conduction and fiber diameter, the various classes of fibers in peripheral nerves differ in their sensitivity to hypoxia and anesthetics. This fact has clinical as well as physiologic significance. Local anesthetics depress transmission in the unmyelinated group C fibers before they affect the myelinated group A fibers</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. Type A fibers are the least sensitive to the effect of local anesthetics. Option C. Type C fibers are most sensitive to the effect of local anesthetics. Option D. Type B fibers have intermediate sensitivity to the effect of local anesthetics.</p>\n<p><strong>Extraedge:</strong></p><p>Somatic senses: touch, proprioception, pain, temperature Types of somatosensory fibers Non-myelinated fibers (type C): slowest; sense burning pain, hot temperature Small myelinated fibers (type Ad): faster; sense sharp pain, gross touch, cold temperature Large myelinated fibers (type A-a; A-ẞ): fastest; sense proprioception, vibration, fine touch</p>\n<p><strong>Table:</strong></p><p>Types of mammalian nerve fibers. Fiber Type Function Fiber Diameter (μm) Conduction Velocity (m/s) Spike Duration (ms) Absolute Refractory Period (ms) A α Proprioception; somatic motor 12-20 70-120 A β Touch, pressure 5-12 30-70 0.4-0.5 0.4-1 A γ Motor to muscle spindles 3-6 15-30 Αδ Pain, temperature 2-5 12-30 B Preganglionic autonomic <3 3-15 1.2 1.2 C, Dorsal root Pain, temperature 0.4-1.2 0.5-2 2 2 C, Sympathetic Postganglionic sympathetic 0.3-1.3 0.7-2.3 2 2 2. Numerical\nclassification of sensory nerve fibers. Number Origin Fiber Type la Muscle spindle, annulo-spiral ending A α Ib Golgi tendon organ Aα ll Muscle spindle, flower-spray ending: touch,\n pressure A β lll Pain and cold receptors; some touch receptors Αδ lV Pain, temperature, and other receptors Dorsal root C 3. Relative\nsusceptibility of mammalian A, B, and C nerve fibers to conduction blocks\nproduced by various agents. Susceptibility To: Most Susceptible Intermediate Least Susceptible Hypoxia B A C Pressure A B C Local anesthetics C B A</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Pain is “an unpleasant sensory and emotional experience associated with actual or potential tissue damage or described in terms of such damage. Select the irrelevant description about pain:", "options": [{"label": "A", "text": "Injured tissues release Na+ ions that depolarize nerve terminals.", "correct": true}, {"label": "B", "text": "Injured tissues release bradykinin and substance P.", "correct": false}, {"label": "C", "text": "Histamine is released from mast cells.", "correct": false}, {"label": "D", "text": "Serotonin (5-HT) is released by platelets.", "correct": false}], "correct_answer": "A. Injured tissues release Na+ ions that depolarize nerve terminals.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Injured tissues release Na+ ions that depolarize nerve terminals. Injured tissues do not release Na+ ions but K+ ions that depolarize nerve terminals.</p>\n<p><strong>Highyeild:</strong></p><p>Chemicals released at the site of injury can further directly activate receptors on sensory nerve endings leading to inflammatory pain. Injured tissues also release chemicals such as K+ that directly depolarize nerve terminals, making nociceptors more responsive (sensitization). Injured tissues also release bradykinin and substance P to further sensitize nociceptive terminals. Histamine is released from mast cells, serotonin (5-HT) from platelets, and prostaglandins from cell membranes, all contributing to the inflammatory process and they activate or sensitize the nociceptors</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. Additionally, injured tissues release bradykinin and substance P. Option C. Histamine is released from mast cells, at the site of injury. Option D. Platelets at the injury site release serotonin (5-HT) and cell membranes release prostaglandins.</p>\n<p><strong>Extraedge:</strong></p><p>Somatic senses: touch, proprioception, pain, temperature Types of somatosensory fibers Non-myelinated fibers (type C): slowest; sense burning pain, hot temperature Small myelinated fibers (type Ad): faster; sense sharp pain, gross touch, cold temperature Large myelinated fibers (type A-a; A-ẞ): fastest; sense proprioception, vibration, fine touch</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Neurologist while explaining the pain physiology, mentioned that damaged nerve fibers undergo sprouting. This can explain why innocuous stimuli can induce pain after an injury. Select the incorrect statement:", "options": [{"label": "A", "text": "Synergistic effect of substance P and glutamate from nociceptive afferents in the spinal cord.", "correct": false}, {"label": "B", "text": "Excessive activation of GABA receptors on spinal neurons.", "correct": true}, {"label": "C", "text": "“wind-up” phenomenon", "correct": false}, {"label": "D", "text": "Raised activity in pain-transmitting pathways", "correct": false}], "correct_answer": "B. Excessive activation of GABA receptors on spinal neurons.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Excessive activation of GABA receptors on spinal neurons. Gamma-aminobutyric acid (GABA) is an amino acid that functions as the primary inhibitory neurotransmitter for the central nervous system (CNS). It functions to reduce neuronal excitability by inhibiting nerve transmission.</p>\n<p><strong>Highyeild:</strong></p><p>The combined release of substance P and glutamate from nociceptive afferents in the spinal cord causes excessive activation of NMDA receptors on spinal neurons, a phenomenon called “wind-up” that leads to increased activity in pain-transmitting</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option A. Synergistic effect of substance P and glutamate from nociceptive afferents in the spinal cord. The synergistic effect of substance P and glutamate from nociceptive afferents in the spinal cord results in excessive activation of NMDA receptors on spinal neurons. Option C. “wind-up” phenomenon When spinal neurons are subjected to repeat or high-intensity nociceptive impulses, they become progressively and increasingly excitable even after the stimulus is removed. This condition is known as central sensitization or wind-up phenomenon and leads to nonresponsive or chronic intractable pain. Option D. Raised activity in pain-transmitting pathways Spinal dorsal horn neurons normally receive only nociceptive input. This can explain why innocuous stimuli can induce pain after an</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Pain is “an unpleasant sensory and emotional experience associated with actual or potential tissue damage or described in terms of such damage. Select the irrelevant description about pain:", "options": [{"label": "A", "text": "Injured tissues release Na+ ions that depolarize nerve terminals.", "correct": true}, {"label": "B", "text": "Injured tissues release bradykinin and substance P.", "correct": false}, {"label": "C", "text": "Histamine is released from mast cells.", "correct": false}, {"label": "D", "text": "Serotonin (5-HT) is released by platelets.", "correct": false}], "correct_answer": "A. Injured tissues release Na+ ions that depolarize nerve terminals.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Injured tissues release Na+ ions that depolarize nerve terminals. Injured tissues do not release Na+ ions but K+ ions that depolarize nerve terminals</p>\n<p><strong>Highyeild:</strong></p><p>Chemicals released at the site of injury can further directly activate receptors on sensory nerve endings leading to inflammatory pain. Injured tissues also release chemicals such as K+ that directly depolarize nerve terminals, making nociceptors more responsive (sensitization). Injured tissues also release bradykinin and substance P to further sensitize nociceptive terminals. Histamine is released from mast cells, serotonin (5-HT) from platelets, and prostaglandins from cell membranes, all contributing to the inflammatory process and they activate or sensitize the nociceptors</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. Additionally, injured tissues release bradykinin and substance P. Option C. Histamine is released from mast cells, at the site of injury. Option D. Platelets at the injury site release serotonin (5-HT) and cell membranes release prostaglandins.</p>\n<p><strong>Extraedge:</strong></p><p>Somatic senses: touch, proprioception, pain, temperature Types of somatosensory fibers Non-myelinated fibers (type C): slowest; sense burning pain, hot temperature Small myelinated fibers (type Ad): faster; sense sharp pain, gross touch, cold temperature Large myelinated fibers (type A-a; A-ẞ): fastest; sense proprioception, vibration, fine touch</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A male patient aged 67 years presented with nauseating pain and a burning sensation when passing urine with frequent urination at night past 3 days. Physicians described the physiology of such types of pain to scholars. Select the irrelevant explanation for the type of pain experienced by the patient:", "options": [{"label": "A", "text": "Presence of Aδ nerve fibers in deep tissues.", "correct": true}, {"label": "B", "text": "Nociceptors are present in visceral organs.", "correct": false}, {"label": "C", "text": "Afferent fibers from visceral structures enter CNS via sympathetic and parasympathetic nerves.", "correct": false}, {"label": "D", "text": "Deep pain and visceral pain are poorly localized, nauseating, and with sweating.", "correct": false}], "correct_answer": "A. Presence of Aδ nerve fibers in deep tissues.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Presence of Aδ nerve fibers in deep tissues. There is a relative deficiency of Aδ nerve fibers in deep structures, so there is little rapid, sharp pain.</p>\n<p><strong>Highyeild:</strong></p><p>The main difference between superficial (cutaneous) and deep or visceral pain is the nature of the pain evoked by noxious stimuli. This may be due to a relative deficiency of Aδ nerve fibers in deep structures, so there is little rapid, sharp pain. Also, deep pain and visceral pain are poorly localized, nauseating, and frequently accompanied by sweating and changes in blood pressure.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. Nociceptors are present in visceral organs. Option C. Afferent fibers from visceral structures enter CNS via sympathetic and parasympathetic nerves. Option D. Deep pain and visceral pain are poorly localized, nauseating, and with sweating</p>\n<p><strong>Extraedge:</strong></p><p>Nociceptors are present in visceral organs, but they are more sparsely distributed than in somatic structures. Afferent fibers from visceral structures reach the CNS via sympathetic and parasympathetic nerves. Somatic senses: touch, proprioception, pain, temperature Types of somatosensory fibers Non-myelinated fibers (type C): slowest; sense burning pain, hot temperature Small myelinated fibers (type Ad): faster; sense sharp pain, gross touch, cold temperature Large myelinated fibers (type A-a; A-ẞ): fastest; sense proprioception, vibration, fine touch</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A patient aged 23 years, was taken to the hospital with chest pain radiating to the left shoulder, and arm, tightness over the chest, and sweating. Persons who escorted the patient gave H/O of starting pain when the patient was working in the office. The patient kept the tablet below the tongue but it had no effect. Select the irrelevant statement:", "options": [{"label": "A", "text": "Divergence of somatic and visceral pain. Fibers from the second-order neurons in the dorsal horn", "correct": true}, {"label": "B", "text": "Referred pain", "correct": false}, {"label": "C", "text": "Tissue of pain origin and tissue of pain felt have the same development from the same dermatome", "correct": false}, {"label": "D", "text": "Convergence projection theory", "correct": false}], "correct_answer": "A. Divergence of somatic and visceral pain. Fibers from the second-order neurons in the dorsal horn", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Divergence of somatic and visceral pain. Fibers from the second-order neurons in the dorsal horn Visceral pain often radiates or is referred to other areas. Irritation of a visceral organ frequently produces pain that is felt not at that site but in a somatic structure that may be some distance away (referred pain).</p>\n<p><strong>Highyeild:</strong></p><p>In referred pain, there is a convergence of somatic and visceral pain fibers on the same second-order neurons in the dorsal horn. The basis for referred pain may be a convergence of somatic and visceral pain fibers on the same second-order neurons in the dorsal horn that project to the thalamus and then to the somatosensory cortex.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. Referred pain where the site of injury and site of pain are separate. Option C. Tissue of pain origin and tissue of pain felt have the same development from the same dermatome is called referred pain. Option D. Convergence projection theory explains referred pain.</p>\n<p><strong>Extraedge:</strong></p><p>This is called the convergence-projection theory. Somatic and visceral neurons converge in the ipsilateral dorsal horn. When the visceral stimulus is prolonged, facilitation of activity from the somatic fiber-endings They now stimulate second-order neurons, and of course, the brain cannot determine whether the stimulus came from the viscera or the area of referral.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 18 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A 64-year-old male was admitted to the hospital with edema and congestive heart failure. He was found to have diastolic dysfunction characterized by the inadequate filling of the heart during diastole. The decrease in the ventricular filling is due to a decrease in ventricular muscle compliance. Which of the following proteins determines the normal stiffness of ventricular muscle?", "options": [{"label": "A", "text": "Calmodulin", "correct": false}, {"label": "B", "text": "Troponin", "correct": false}, {"label": "C", "text": "Tropomyosinf", "correct": false}, {"label": "D", "text": "Titin", "correct": true}], "correct_answer": "D. Titin", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Titin Titin is a large protein that connects the Z lines to the M lines, thereby providing a scaffold for the sarcomere. Titin contains two types of folded domains that provide the muscle with its elasticity.</p>\n<p><strong>Highyeild:</strong></p><p>The resistance to stretch increases throughout a contraction, which protects the structure of the sarcomere and prevents excess stretch. Due to its enormous size and structural role in the sarcomere, titin is a prominent target for mutations that give rise to muscle disease. Mutations that encode for shorter titin structures have been associated with dilated cardiomyopathy, while other mutations have been associated with hypertrophic cardiomyopathy.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Calmodulin acts as an intermediary protein that senses calcium levels and relays signals to various calcium-sensitive enzymes, ion channels, and other proteins. Option B. Troponin is a type of protein found in the muscles of your heart. As heart damage increases, greater amounts of troponin are released in the blood. Option C. Tropomyosin binds along actin filaments and regulates actin-myosin interaction in muscle and nonmuscle cells.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Identify the marked structure in the given Image which senses the change in muscle length:-", "options": [{"label": "A", "text": "Alpha Gamma", "correct": false}, {"label": "B", "text": "Muscle spindle", "correct": true}, {"label": "C", "text": "Muscle head", "correct": false}, {"label": "D", "text": "Mesencephalon", "correct": false}], "correct_answer": "B. Muscle spindle", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683534150057-QTDY041002IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Muscle spindle Each muscle spindle has three essential elements: A group of specialized intrafusal muscle fibers with contractile polar ends and a noncontractile Large diameter myelinated afferent nerves (types Ia and II) originating in the central portion of the intrafusal fibers, and Small diameter myelinated efferent nerves supplying the polar contractile regions of the intrafusal fibers.</p>\n<p><strong>Highyeild:</strong></p><p>It is important to understand the relationship of these elements to each other and to the muscle itself to appreciate the role of this sense organ in signaling changes in the length of the muscle in which it is located. Changes in muscle length are associated with changes in joint angle; thus muscle spindles provide information on position.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest options are not appropriate.</p>\n<p><strong>Extraedge:</strong></p><p>Muscle proprioceptors</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 29-year-old woman presents with a unilateral headache of pulsating nature associated with nausea and photophobia. She has been eating cheesecakes recently since she started attending baking classes. The physician gives her an antiemetic with an NSAID to abort the pain. She demands something to avoid the pain in the future. The physician prescribes her a drug for prophylactic management of this pain. This drug is also used as an anticonvulsant medication to block receptors of a major excitatory neurotransmitter in the brain. Which of the following is the excitatory neurotransmitter?", "options": [{"label": "A", "text": "Acetylcholine", "correct": false}, {"label": "B", "text": "Aspartate", "correct": false}, {"label": "C", "text": "GABA", "correct": false}, {"label": "D", "text": "Glutamate", "correct": true}], "correct_answer": "D. Glutamate", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Glutamate This patient suffers from migraines due to tyramine-containing food consumption (cheesecakes). Pulsating pain on one side associated with nausea and photophobia all points towards a diagnosis of migraine. Migraine is due to irritation of the meninges, trigeminal nerve, or blood vessels. Topiramate is an anticonvulsant that is also used in migraine prophylaxis It binds and blocks glutamate receptors and sodium channels. Hence glutamate is the correct choice.</p>\n<p><strong>Highyeild:</strong></p><p>Glutamate is the major excitatory neurotransmitter; 60% of brain synapses are glutamatergic. Glutamate functions to regulate memory. It is also associated with pain. It is needed for the proper function of the brain. Too much glutamate can cause excitotoxicity.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options: Option A: Acetylcholine The major function of acetylcholine is muscle stimulation, including the gastrointestinal and autonomic nervous Furthermore, the scenario points toward topiramate blocking glutamate receptors; hence this is the incorrect choice. Option B: Aspartate Topiramate is used for migraine prophylaxis which is a glutamate receptor blocker. Option C: GABA GABA is the major inhibitory neurotransmitter. Topiramate blocks glutamate receptors; hence this is not the right choice.</p>\n<p><strong>Extraedge:</strong></p><p>A-delta fibers t hat carry sharp pricking pain also release glutamate. Glutamate is the principal excitatory neurotransmitter of the central nervous system and the most abundant neurotransmitter in the brain . It is stored within vesicles in axon terminals and released via exocytosis upon the influx of calcium cations. Glutamate has clinical relevance in neurology and psychiatry, specifically regarding depression, substance use disorder, schizophrenia, neurodegenerative diseases, and other cognitive function and mood deficits.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following is a membrane-bound enzyme that catalyzes the formation of cyclic AMP from ATP?", "options": [{"label": "A", "text": "Tyrosine kinase", "correct": false}, {"label": "B", "text": "Polymerase", "correct": false}, {"label": "C", "text": "ATP synthase", "correct": false}, {"label": "D", "text": "Adenylyl cyclase", "correct": true}], "correct_answer": "D. Adenylyl cyclase", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Adenylyl cyclase Adenylate cyclase (AC) is the only enzyme that generates the secondary messenger 3′:5′-adenosine monophosphate (cyclic AMP) out of ATP.</p>\n<p><strong>Highyeild:</strong></p><p>Upon excitation of the receptor protein, an alpha subunit breaks away from the G protein and activates adenylyl cyclase, which is attached to the inside of the ciliary membrane near the receptor cell body. The activated cyclase, in turn, converts many molecules of intracellular adenosine triphosphate into cyclic adenosine monophosphate (cAMP). Finally, this cAMP activates another nearby membrane protein, a gated sodium ion channel, that opens its “gate” and allows large numbers of sodium ions to pour through the membrane into the receptor cell cytoplasm.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Tyrosine kinases are a part of many cell functions, including cell signaling, growth, and division. Option B. DNA polymerase (DNAP) is a type of enzyme that is responsible for forming new copies of DNA, in the form of nucleic acid molecules. Option C. The overall reaction catalyzed by ATP synthase is: ADP + Pi + 2H+out ⇌ ATP + H2O + 2H.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following substances increases the release of Ca++ from the endoplasmic reticulum?", "options": [{"label": "A", "text": "Inositol triphosphate", "correct": true}, {"label": "B", "text": "Parathyroid hormone", "correct": false}, {"label": "C", "text": "1, 25-dihydroxy cholecalciferol", "correct": false}, {"label": "D", "text": "Diacylglycerol", "correct": false}], "correct_answer": "A. Inositol triphosphate", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Inositol triphosphate The calcium-sensing receptor is a G protein-coupled receptor that, when stimulated by calcium ions, activates phospholipase C and increases intracellular inositol 1,4,5-triphosphate and diacylglycerol formation. This activity stimulates the release of calcium from intracellular stores.</p>\n<p><strong>Highyeild:</strong></p><p>Inositol trisphosphate is a second messenger that controls many cellular processes by generating internal calcium signals. It operates through receptors whose molecular and physiological properties closely resemble the calcium-mobilizing ryanodine receptors of muscle.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. Changes in extracellular fluid calcium ion concentration are detected by a calcium-sensing receptor in parathyroid cell membranes. Option C. 1, 25-dihydroxy cholecalciferol production is stimulated by low blood calcium levels and parathyroid hormone. Option D. Triacylglycerol (TAG), one possible metabolic precursor of DAG, contains three fatty acids (FAs) esterified to the trihydric alcohol glycerol.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The first physiological response to high environmental temperature is:", "options": [{"label": "A", "text": "Sweating", "correct": false}, {"label": "B", "text": "Vasodilatation", "correct": true}, {"label": "C", "text": "Decrease heat production", "correct": false}, {"label": "D", "text": "Non-shivering thermogenesis", "correct": false}], "correct_answer": "B. Vasodilatation", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Vasodilatation Vasodilation is caused by the inhibition of the sympathetic centers in the posterior hypothalamus.</p>\n<p><strong>Highyeild:</strong></p><p>The temperature control system uses three important mechanisms to reduce body heat:- Vasodilation of skin blood vessels. In almost all areas of the body, the skin blood vessels become intensely dilated.This dilation is caused by inhibition of the sympathetic centers in the posterior hypothalamus that cause vasoconstriction. Full vasodilation can increase the rate of heat transfer to the skin as much as eightfold.</p>\n<p><strong>Random:</strong></p><p>Explanation for incorrect Options: Option A. The effect of increased body temperature to cause sweating is demonstrated by the blue curve, which shows a sharp increase in the rate of evaporative heat loss resulting from sweating. Option C & D. Decrease in heat production. T he mechanisms that cause excess heat production, such as shivering and chemical thermogenesis, are strongly inhibited.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following triggers muscle contraction?", "options": [{"label": "A", "text": "Ca2+ binding tropomyosin", "correct": false}, {"label": "B", "text": "Ca2+ binding troponin C", "correct": true}, {"label": "C", "text": "ATP breakdown", "correct": false}, {"label": "D", "text": "Ca2+ binding troponin I", "correct": false}], "correct_answer": "B. Ca2+ binding troponin C", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Ca2+ binding troponin C Troponin and Its Role in Muscle Contraction. Attached intermittently along the sides of the tropomyosin molecules are additional protein molecules called troponin. These protein molecules are complexes of three loosely bound protein subunits, each of which plays a specific role in controlling muscle contraction. One of the subunits (troponin I) has a strong affinity for actin, another (troponin T) for tropomyosin, and a third (troponin C) for calcium ions. This complex is believed to attach the tropomyosin to the actin. The strong affinity of the troponin for calcium ions is believed to initiate the contraction process.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options: Option A. On activation, Ca2+ binding to troponin leads to an azimuthal motion of tropomyosin around the actin filament that uncovers the myosin binding sites, permitting the actin-myosin interaction that drives contraction. Option C. ATP binding to myosin during the contractile cycle results in myosin detachment from actin, and energy liberated from subsequent ATP hydrolysis is then used to drive the next contractile cycle. ATP is also used to lower myoplasmic calcium levels during muscle relaxation.</p>\n<p><strong>Extraedge:</strong></p><p>Figure:- Cardiac sarcomere structure, featuring troponin C. Troponin C is a protein that is part of the troponin complex. It contains four calcium-binding EF hands, although different isoforms may have fewer than four functional calcium-binding subdomains. It is a component of thin filaments, along with actin and tropomyosin. It contains an N lobe and a C lobe. The C lobe serves a structural purpose and binds to the N domain of troponin I (TnI). The C lobe can bind either Ca2+ or Mg2+. The N lobe, which binds only Ca2+, is the regulatory lobe and binds to the C domain of troponin I after calcium binding.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Jitendra, a 21-year-old male patient presented to a rural emergency center with a 1-day history of progressive stiffness of the neck and jaw, difficulty swallowing, stiff shoulders and back, and a rigid abdomen. Upon further questioning, the patient reports that the stiff jaw was the first symptom, followed by a stiff neck and dysphagia. On examination, he is noted to have stiffness in the neck, shoulder, and arm muscles. He has a grimace on his face that he cannot stop voluntarily and an arched back from contracted back muscles. The physician concludes that the patient has “tetanic” skeletal muscle contractions. A 3-cm laceration is noted on his left foot. The patient reports sustaining the laceration about 7 days ago while he was plowing the fields on his farm. He has not had a tetanus booster. He is diagnosed with a tetanus infection, and an injection of tetanus antitoxin is given. On which skeletal muscle filament is troponin located?", "options": [{"label": "A", "text": "At Thick filament", "correct": false}, {"label": "B", "text": "At Thin filament", "correct": true}, {"label": "C", "text": "At Both thick and thin filament", "correct": false}, {"label": "D", "text": "None of them", "correct": false}], "correct_answer": "B. At Thin filament", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>At Thin filament Troponin location at Thin filaments. Th is patient with Acute tetanus presents with muscle rigidity in the face, jaw, shoulders, back, and upper extremities 7 days after sustaining a puncture wound while working on his farm. He is diagnosed with tetanus.</p>\n<p><strong>Highyeild:</strong></p><p>The sarcoplasmic reticulum function is the storage and release of calcium. The molecular basis of contraction is Calcium-troponin-C binding. Contraction of skeletal muscle is due to the interaction of the proteins actin and myosin, which constitute thin and thick filaments, respectively. ATP is consumed in the process.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options: Troponin location at Thin filaments, not thick filaments.</p>\n<p><strong>Extraedge:</strong></p><p>Relationships of thick and thin filaments and adjacent Z disks of a sarcomere in a relaxed and contracted state. Actin and myosin are proteins that form the basic structural characteristic of striated muscle and are arranged in filaments: actin in thin filaments and myosin in thick filaments. In the thin filaments, the monomers of actin are polymerized together like two strands of pearls that are twisted in an α helix to form F-actin (filamentous).</p>\n<p><strong>Table:</strong></p><p>Physiology of Tetanus · Tetanus is a neurologic disorder caused by the toxin produced by the\nbacterium Clostridium tetani. · Clostridium tetani is an anaerobic gram-positive motile rod that\nis found worldwide in soil, inanimate environments, animal feces, and\noccasionally human feces. Contamination in wounds with spores of C. tetani is\nseen commonly, but germination and toxin production occurs only in\ndevitalized tissue, areas with foreign bodies, and active infection. · The toxin that is released blocks the release of several\ninhibitory neurotransmitters, including γ-aminobutyric acid (GABA), altering\nthe synaptic vesicle release apparatus. With diminished inhibition, the resting\nfiring rate of motor neurons increases. Because of the increased repetitive\nstimulation of the motor neuron, the calcium released from the SR remains bound\nto troponin and extends the time for cross-bridge cycling, resulting in muscles\nthat do not relax. · Muscle spasms can be controlled with medications such as diazepam (GABA\nagonist). Protection of the airway is essential.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "While you are standing, holding a tray piled with dishes, an additional 2.267kg of dishes is placed on your tray. Your muscles that are holding the dishes increase their force of contraction through an increase in which of the following?", "options": [{"label": "A", "text": "Length of the muscle", "correct": false}, {"label": "B", "text": "Number of motor units activated and the frequency of their activation", "correct": true}, {"label": "C", "text": "Peak intracellular calcium concentration in the muscle", "correct": false}, {"label": "D", "text": "Strength of each cross-bridge interaction with actin", "correct": false}], "correct_answer": "B. Number of motor units activated and the frequency of their activation", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Number of motor units activated and the frequency of their activation The increase in the force of contraction of skeletal muscle is regulated by the number of motor units recruited by the central nervous system (CNS) and by their frequency of activation (summation and tetanus). Vmax does not come into play because the muscle is contracting isometrically and Vmax is determined by the maximal ATPase activity of the myosin, which is not changing.</p>\n<p><strong>Highyeild:</strong></p><p>The force of muscle contraction is regulated by the number of motor units activated (recruitment) and by the frequency with which they are being activated (summation and tetanus). Contractions can be isometric (force generation but no change in length) or isotonic (force generation and changes in length).</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. The length of the muscle is not changing because this is an isometric contraction and because even during an isotonic contraction, the length of a skeletal muscle does not change appreciably. With each contraction. Option C. The amount of calcium released from internal stores is about the same, so peak intracellular calcium concentrations will not rise to higher levels. Option D. During an isometric contraction each cross-bridge interaction with actin will generate the same amount of force. The increase in total force is because of an increase in the number of actin-myosin interactions taking place at the same time.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 19 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "In the given normal ECG, in which phase does the left ventricular subendocardium receive blood supply through the coronary arteries:-", "options": [{"label": "A", "text": "PR interval", "correct": false}, {"label": "B", "text": "QRS duration", "correct": false}, {"label": "C", "text": "QT interval", "correct": false}, {"label": "D", "text": "After T wave", "correct": true}], "correct_answer": "D. After T wave", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683533788560-QTDY037001IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>After T wave The coronary circulation to the left ventricular subendocardial takes place only during the ventricular diastole . So, the left ventricular subendocardial receives blood supply after the T wave.</p>\n<p><strong>Highyeild:</strong></p><p>The coronary circulation takes place during the Ventricular diastole. In ECG: P wave represents Atrial depolarisation O wave represents septal depolarisation of the interventricular septum R wave represents Ventricular repolarization S wave represents basal depolarisation T wave represents Ventricular repolarization ECG intervals: PR interval: Atrial depolarisation and conduction through A V nodes QRS duration: Ventricular depolarisation and Atrial repolarization QT interval: Ventricular repolarization.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest options do not sit appropriately.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 72-year-old man with an atrial rate of 80 beats/min develops a third-degree (complete) AV block. A pacemaker site located in the AV node below the region of the block triggers ventricular activity, but at a rate of only 40 beats/min. What would be observed?", "options": [{"label": "A", "text": "One P wave for each QRS complex", "correct": false}, {"label": "B", "text": "An inverted T wave", "correct": false}, {"label": "C", "text": "A shortened PR interval", "correct": false}, {"label": "D", "text": "A normal QRS complex", "correct": true}], "correct_answer": "D. A normal QRS complex", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>A normal QRS complex When conduction from the atria to the ventricles is completely interrupted, complete (third-degree) heart block results , and the ventricles beat at a low rate (idioventricular rhythm) independently of the atria. A form of QRS will be normal because electrical excitation of the ventricles occurs over essentially the normal pathway (i.e., AV node to bundle branches to Purkinje system to myocardium).</p>\n<p><strong>Highyeild:</strong></p><p>The T-wave will be normal as well. With a complete heart block, the P wave and QRS complex are independent of each other. Some PR intervals could be shortened by chance, others will be very long, that is there is a predictable PR interval. There will not be a consistent ratio of P waves to QRS complex, because the two are disassociated, but the average ratio would be 80/40.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. 1:1 relationship between P waves and QRS complexes (for every P wave, a QRS complex is conducted). Option B . Inverted T waves are associated with myocardial ischemia. Option C. The presence of a short PR interval, frequently with a delta wave, defines the preexcitation syndrome.</p>\n<p><strong>Extraedge:</strong></p><p>Sick sinus syndrome (bradycardia-tachycardia syndrome; sinus node dysfunction) is a collection of heart rhythm disorders that include sinus bradycardia (slow heart rates from the natural pacemaker of the heart), tachycardias (fast heart rates), and bradycardia-tachycardia (alternating slow and fast heart rhythms). Sick sinus syndrome is relatively uncommon and is usually found in people older than 50. In patients with AV nodal block, the remaining nodal tissue becomes the pacemaker and the rate of the idioventricular rhythm is approximately 45 beats/min. In patients with infranodal block due to disease in the bundle of His, the ventricular pacemaker is located more peripherally in the conduction system and the ventricular rate is lower; it averages 35 beats/min, but in individual cases, it can be as low as 15 beats/min. In such individuals, there may also be periods of asystole lasting a minute or more. The resultant cerebral ischemia causes dizziness and fainting (Stokes–Adams syndrome). Causes of third-degree heart block include septal myocardial infarction and damage to the bundle of His during surgical correction of congenital interventricular septal defects. When conduction between the atria and ventricles is slowed but not completely interrupted, incomplete heart block is present. In the form called first-degree heart block, all the atrial impulses reach the ventricles but the PR interval is abnormally long. In the form called second-degree heart block, not all atrial impulses are conducted to the ventricles. For example, a ventricular beat may follow every second or every third atrial beat (2:1 block, 3:1 block, etc). In another form of incomplete heart block, there are repeated sequences of beats in which the PR interval lengthens progressively until a ventricular beat is dropped (Wenckebach phenomenon). The PR interval of the cardiac cycle that follows each dropped beat is usually normal or only slightly prolonged.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A normal electrocardiogram (ECG) trace of one cardiac cycle, and a normal recording of one ventricular action potential, are shown. The wave on the ECG trace marked with a star most closely corresponds to which phase of the ventricular action potential?", "options": [{"label": "A", "text": "Phase O", "correct": false}, {"label": "B", "text": "Phase 1", "correct": false}, {"label": "C", "text": "Phase 2", "correct": false}, {"label": "D", "text": "The event is not visible.", "correct": true}], "correct_answer": "D. The event is not visible.", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/questionImage-1719205806373-photos-1613643975446-ibqt5img1.jpg"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The event is not visible. The wave on the ECG trace marked with a star is the P wave and is produced by atrial depolarization. Since the action potential recording shown is for ventricular myocyte depolarization, atrial depolarization is not visible on this recording.</p>\n<p><strong>Highyeild:</strong></p><p>Phases 0 and 1 most closely correspond with the QRS complex. Phase 2 most closely corresponds with the ST segment. Phase 3 most closely corresponds with the T wave. Phase 4 most closely corresponds with the TP segment between the end of the T-wave and the start of the next P-wave.</p>\n<p><strong>Extraedge:</strong></p><p>A long QT interval is defined as a prolongation of the QT interval based on an ECG. LQTS can lead to irregular heartbeats and subsequent fainting, seizure, cardiac arrest, or even death. Occurs due to mutations in cardiac expressed voltage-gated K+ channel genes and Na+ channel genes. Patients with LQTS should avoid drugs that prolong the QT interval or reduce serum K+ or Mg In general, Beta Blockers have been used for LQTS to reduce the risk of cardiac arrhythmias.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "During a semi-annual exam, the electrocardiogram (ECG) recording of a trained athlete reveals a cardiac arrhythmia shown in the following trace. The abnormality seen in this lead II trace is due to a change in which of the following electrical event(s) in the heart?", "options": [{"label": "A", "text": "Atrial depolarization", "correct": false}, {"label": "B", "text": "Atrial repolarization", "correct": false}, {"label": "C", "text": "Atrioventricular (AV) conduction time", "correct": true}, {"label": "D", "text": "Ventricular depolarization", "correct": false}], "correct_answer": "C. Atrioventricular (AV) conduction time", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683533788613-QTDY037004IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Atrioventricular (AV) conduction time This ECG trace shows a first-degree heart block, which is indicated by long PR intervals without any missing QRS complexes.</p>\n<p><strong>Highyeild:</strong></p><p>The PR interval includes the recording of the depolarizations of the conduction tissue from the sinoatrial (SA) node to the Purkinje fibers and indicates how long it takes the conduction cells (not myocytes) to depolarize. The typical duration is 0.12–0.20 seconds, and trained athletes may have a long PR interval due to increased vagal tone to the heart. The QRS complex is dominated by ventricular depolarization T wave by ventricular repolarization. The U wave is an inconstant finding that may be due to ventricular myocytes with long action potentials.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. The P wave is primarily produced by atrial depolarization , Option B. There is no distinctly visible wave representing atrial repolarization in the ECG because it occurs during ventricular depolarization. Because the wave of atrial repolarization is relatively small in amplitude (i.e., has low voltage), it is masked by the much larger ventricular-generated QRS complex. Option D. Ventricular depolarization (activation) is depicted by the QRS complex, whereas ventricular repolarization is defined by the interval from the beginning of the QRS complex to the end of the T- or U-wave.</p>\n<p><strong>Extraedge:</strong></p><p>CARDIAC EVENTS</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "In a healthy person with a heart rate of 60 beats per minute, which of the following periods in the electrocardiogram (ECG) would be the longest?", "options": [{"label": "A", "text": "P wave", "correct": false}, {"label": "B", "text": "P-R interval", "correct": false}, {"label": "C", "text": "QRS complex", "correct": false}, {"label": "D", "text": "Q-T interval", "correct": true}], "correct_answer": "D. Q-T interval", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Q-T interval In an ECG of a healthy person with a heartbeat of 60 beats per minute, the longest part of the cardiac cycle is ventricular depolarization and repolarization, represented by the Q-T interval.</p>\n<p><strong>Highyeild:</strong></p><p>The P wave is caused by electrical potentials generated when the atria depolarize before an atrial contraction begins. The QRS complex is caused by potentials generated when the ventricles depolarize before contraction, that is, as the depolarization wave spreads through the ventricles. Therefore, both the P wave and the components of the QRS complex are depolarization waves. The T wave is caused by potentials generated as the ventricles recover from the state of depolarization. This process normally occurs in ventricular muscle 0.25 to 0.35 seconds after depolarization. The T wave is known as a repolarization wave.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. The P wave in an electrocardiogram (ECG) represents the depolarization of the atria of the heart. It is the first wave in the ECG and is usually a small, smooth upward deflection that occurs before the QRS complex. Option B. The P-R interval in an electrocardiogram (ECG) represents the time it takes for the electrical signal to travel from the atria to the ventricles of the heart. It is measured from the beginning of the P wave to the beginning of the QRS complex. Option C. The QRS complex in an electrocardiogram (ECG) represents the depolarization of the ventricles of the heart. It is typically the largest wave in the ECG and is measured from the beginning of the Q wave to the end of the S wave or to the end of the R wave if there is no S wave.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 61-year-old man with a previous myocardial infarction presents with shortness of breath and fatigue. An electrocardiogram is ordered. The trace reveals wide QRS complexes in all leads. Which of the following changes to cardiac innervation or conduction is most likely responsible for the wide QRS complexes?", "options": [{"label": "A", "text": "Decreased parasympathetic innervation to the heart", "correct": false}, {"label": "B", "text": "Decreased conduction rate along the bundle branches", "correct": true}, {"label": "C", "text": "Decreased conduction rate from the SA node to the AV node", "correct": false}, {"label": "D", "text": "Sinus bradycardia", "correct": false}], "correct_answer": "B. Decreased conduction rate along the bundle branches", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Decreased conduction rate along the bundle branches If it takes longer for the cells in the bundle branches to depolarize (e.g., due to damage), then there is a delay in the depolarization of myocytes in th e ventricular septum. Since the QRS complex is recorded when ventricular myocytes are depolarizing, any delay will increase the duration of the QRS complex and widen it.</p>\n<p><strong>Highyeild:</strong></p><p>The QRS complex represents the depolarization of ventricles. It shows the beginning of systole and ventricular contraction. The QRS complex or wave starts with a small deflection downwards, represented by the point Q. It follows the P wave.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. FALSE- Decreased parasympathetic innervation to the heart will increase heart rate and increase conduction rate. Option: C. FALSE- Decreased conduction time from the SA node to the AV node will impact the duration of the P wave. Option: D. FALSE- Sinus bradycardia and tachycardia will primarily alter the length of the T-P interval and have little effect on the QRS.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 58-year-old woman complains of shortness of breath on exertion. An electrocardiogram (ECG) is ordered and her lead I trace is shown. Which of the following waves, segments, or intervals on her ECG trace is outside of the normal range?", "options": [{"label": "A", "text": "P wave", "correct": false}, {"label": "B", "text": "P-R interval", "correct": true}, {"label": "C", "text": "QRS complex", "correct": false}, {"label": "D", "text": "ST segment", "correct": false}], "correct_answer": "B. P-R interval", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683533788677-QTDY037007IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>P-R interval The P-R interval is measured from the beginning of the P wave to the beginning of the QRS complex and should be between 0.12 and 0.20 seconds in duration, which is 3–5 small boxes on the ECG paper (each small box is 0.04 seconds). This patient’s P-R interval is 0.36 seconds (9 small boxes), which is abnormally long, indicating a first-degree atrioventricular block.</p>\n<p><strong>Highyeild:</strong></p><p>The normal duration of the P wave is shorter than 0.12 seconds (3 small boxes) and is normal for this patient. The normal duration of the QRS complex is less than 0.10 seconds (2.5 small boxes) and is normal for this patient. The normal duration of the S-T segment is 0.8 to 0.12 seconds (2–3 small boxes) and is normal for this patient.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The wife of an elderly man, who is recovering normally in the hospital from surgery, nervously shouts for help. She reports that she just looked at the cardiac monitor for the first time and saw that the electrocardiogram (ECG) looks tiny and almost flat. The responding resident does not see any signs of patient distress. The ECG shows sinus rhythm. When the ECG is switched from the currently displayed lead I to leads II or III, the R wave amplitudes increase and are both about the same height. When the ECG is switched to aVF, the R waves are taller than in leads I, lI, and III. Which of the following will the resident physician most likely do next?", "options": [{"label": "A", "text": "Ask the family member to continue watching", "correct": false}, {"label": "B", "text": "Call emergency code blue", "correct": false}, {"label": "C", "text": "Consult a cardiologist", "correct": false}, {"label": "D", "text": "Explain that the patient's heart is beating normally", "correct": true}], "correct_answer": "D. Explain that the patient's heart is beating normally", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Explain that the patient's heart is beating normally The equal R wave amplitudes of leads II and III and the largest R wave amplitude in aVF indicate that the patient’s mean QRS electrical axis is close to +90°.</p>\n<p><strong>Highyeild:</strong></p><p>The flat ECG appearance in lead I indicates that it is the isoelectric lead axis, with the QRS vector perpendicular to the lead and hence causing only very small deflections. The sinus rhythm and the absence of any other clinical signs indicate that the heart is beating normally. </p</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options: Option: A. Asking a family member to monitor THE ECG is inappropriate. Option: B. Code blue initiates an emergency response for a patient in cardiac arrest. Option: C. An expert cardiologist does not need to be consulted, since every hospital physician understands the basics of a 12-lead ECG.</p>\n<p><strong>Extraedge:</strong></p><p>NORMAL SINUS RHYTHM In the normal human heart, each beat originates in the SA node (normal sinus rhythm, NSR). The heart beats about 70 times a minute at rest. The rate is slowed (bradycardia) during sleep and accelerated (tachycardia) by emotion, exercise, fever, and many other stimuli. In healthy young individuals breathing at a normal rate, the heart rate varies with the phases of respiration; it accelerates during inspiration and decelerates during expiration, especially if the depth of breathing is increased. CLINICAL INTEGRATION EDGE-SICK SINUS SYNDROME Sick sinus syndrome (bradycardia-tachycardia syndrome; sinus node dysfunction) is a collection of heart rhythm disorders that include sinus bradycardia (slow heart rates from the natural pacemaker of the heart), tachycardias (fast heart rates), and bradycardia-tachycardia (alternating slow and fast heart rhythms).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 13-year-old girl presents with recurrent episodes of syncope, which are induced by bending over (e.g., to tie her shoes). Her electrocardiogram (ECG) reveals a short P-R interval and a delta wave. Based on her presentation, her symptoms are most likely caused by abnormal accessory conduction pathways through which structure of the heart?", "options": [{"label": "A", "text": "Atrial septum", "correct": false}, {"label": "B", "text": "Atrioventricular node", "correct": false}, {"label": "C", "text": "Atrioventricular ring", "correct": true}, {"label": "D", "text": "Heart valves", "correct": false}], "correct_answer": "C. Atrioventricular ring", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Atrioventricular ring The syncope and ECG findings are characteristic of Wolff-Parkinson-White (WPW) syndrome. In this syndrome, the heart has abnormal conduction pathways between the atria and ventricles through the atrioventricular (AV) ring, which normally does not conduct an electrical current; these pathways disrupt the normal conduction pathway and electrical activity of the heart.</p>\n<p><strong>Highyeild:</strong></p><p>WPW pattern is a constellation of electrocardiographic findings, so initial evaluation relies on a surface electrocardiogram. The ECG will show a short PR interval (<120 ms), prolonged QRS complex (>120 ms), and a QRS morphology consisting of a slurred delta wave.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. FALSE- The atrial and ventricular septa have normal conduction pathways and are not disrupted by WPW. Option: B. FALSE- The AV node is the normal conduction pathway from the atria to the ventricles. Option: D. FALSE- The heart valves do not conduct electrical currents.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A patient with an inferior MI develops a stable bradycardia of 50/min. The cardiologist orders an ECG to evaluate whether there is sinus node dysfunction or an atrioventricular conduction disturbance. The diagnosis of a first-degree heart block is made in which of the following cases?", "options": [{"label": "A", "text": "The PR interval of the ECG is increased.", "correct": true}, {"label": "B", "text": "The P wave of the ECG is never followed by a QRS complex.", "correct": false}, {"label": "C", "text": "The P wave of the ECG is sometimes followed by a QRS complex.", "correct": false}, {"label": "D", "text": "The T wave of the ECG is inverted.", "correct": false}], "correct_answer": "A. The PR interval of the ECG is increased.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The PR interval of the ECG is increased. The diagnosis of a first-degree heart block is made when the PR interval of the ECG is increased. The PR interval represents the time it takes for the cardiac action potential to propagate from the SA node to the ventricular muscle . A delay in this interval, normally produced by a slowing in the conduction velocity through the AV node, is called a first-degree heart block. A second-degree heart block occurs when the action potential does not always propagate through the SA node. This produces an uneven heartbeat. A third-degree block occurs when the action potential never reaches the ventricle. Under these conditions, pacemakers within the ventricle produce ventricular contraction but the rate is very slow. Inversion of the T wave and elevation of the ECG are indicators of membrane potential defects within the ventricular muscle.</p>\n<p><strong>Highyeild:</strong></p><p>First-degree heart block: When conduction between the atria and ventricles is slowed but not completely interrupted, incomplete heart block is present. In the form called first-degree heart block, all the atrial impulses reach the ventricles but the PR interval is abnormally long. In second-degree heart block: not all atrial impulses are conducted to the ventricles. For example, a ventricular beat may follow every second or every third atrial beat (2:1 block, 3:1 block, etc). In another form of incomplete heart block, there are repeated sequences of beats in which the PR interval lengthens progressively until a ventricular beat is dropped (Wenckebach phenomenon). The PR interval of the cardiac cycle that follows each dropped beat is usually normal or only slightly prolonged. Sometimes one branch of the bundle of His is interrupted, causing a right or left bundle branch block. In a bundle branch block, excitation passes normally down the bundle on the intact side and then sweeps back through the muscle to activate the ventricle on the blocked side. The ventricular rate is therefore normal, but the QRS complexes are prolonged and deformed. Block can also occur in the anterior or posterior fascicle of the left bundle branch, producing the condition called hemiblock or a fascicular block. The left anterior hemiblock produces abnormal left axis deviation in the ECG, whereas the left posterior hemiblock produces abnormal right axis deviation.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- If the P wave of the ECG is never followed by a QRS complex, this is likely indicative of a complete heart block, which is a more severe conduction abnormality. Similarly, if the P wave of the ECG is sometimes followed by a QRS complex, this may be indicative of a second-degree heart block, in which some P waves are conducted to the ventricles and others are not. The T wave of the ECG being inverted may be indicative of various cardiac conditions, but is not related to the diagnosis of heart block.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which part of the ECG corresponds to ventricular repolarization?", "options": [{"label": "A", "text": "The P wave", "correct": false}, {"label": "B", "text": "The QRS duration", "correct": false}, {"label": "C", "text": "The T wave", "correct": true}, {"label": "D", "text": "The U wave", "correct": false}], "correct_answer": "C. The T wave", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The T wave The T wave is caused by potentials generated as the ventricles recover from the state of depolarization. This process normally occurs in ventricular muscle 0.25 to 0.35 seconds after depolarization. The T wave is known as a repolarization wave.</p>\n<p><strong>Highyeild:</strong></p><p>The P wave is caused by electrical potentials generated when the atria depolarize before an atrial contraction begins. The QRS complex is caused by potentials generated when the ventricles depolarize before contraction, that is, as the depolarization wave spreads through the ventricles. Therefore, both the P wave and the components of the QRS complex are depolarization waves.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. The P wave is caused by electrical potentials generated when the atria depolarize before an atrial contraction begins. Option B. The QRS complex is caused by potentials generated when the ventricles depolarize before contraction, that is, as the depolarization wave spreads through the ventricles. Therefore, both the P wave and the components of the QRS complex are depolarization waves. Option C. U waves represent the last phase of ventricular repolarization. Prominent U waves are characteristic of hypokalemia.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Produced by depolarization of atrial fibers in ECG is_______ :", "options": [{"label": "A", "text": "P wave", "correct": true}, {"label": "B", "text": "Prolonged PR interval", "correct": false}, {"label": "C", "text": "QRS complex", "correct": false}, {"label": "D", "text": "ST segment", "correct": false}], "correct_answer": "A. P wave", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683533788707-QTDY037012IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>P wave The P wave is produced by atrial depolarization.</p>\n<p><strong>Highyeild:</strong></p><p>The P wave is slower and shorter than the QRS complex because the atria lack a fast conducting system corresponding to the bundle of the His-Purkinje fiber system to synchronize the depolarization of the atrial working fibers.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. The PR interval is prolonged because conduction through the AV node is slowed significantly during first-degree heart block. Option C. The QRS complex represents the depolarization of ventricles. It shows the beginning of systole and ventricular contraction. Option D. The ST segment represents the interval between depolarization and repolarization of the ventricles.</p>\n<p><strong>Extraedge:</strong></p><p>First-degree heart block: Prolongation of the time taken for action potentials to propagate through the AV node (abnormally long PR interval). Second-degree heart block: Failure of some but not all action potentials to propagate through the AV node (greater number of P waves than QRS complexes). Third-degree heart block: Failure of all action potentials to propagate through the AV node (no correlation between P waves and QRS complexes).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The patient's ECG shows that in the second lead from the extremities, the P waves are positive. Their amplitude is 0.1 mV (norm is 0.05-0.25 mV), and duration – 0.1 sec (norm is 0.07-0.10 sec). It can be concluded that which of the following process occurs normally in the cardiac atria:", "options": [{"label": "A", "text": "Activation", "correct": false}, {"label": "B", "text": "Relaxation", "correct": false}, {"label": "C", "text": "Depolarization", "correct": true}, {"label": "D", "text": "Repolarization", "correct": false}], "correct_answer": "C. Depolarization", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Depolarization The P wave is the first deflection and is normally a positive (upward) waveform. It indicates atrial depolarization.</p>\n<p><strong>Highyeild:</strong></p><p>The P wave on the ECG represents atrial depolarization, which results in atrial contraction, or atrial systole. Peaked P waves (> 0.25 mV) suggest right atrial enlargement, cor pulmonale, (P pulmonale rhythm) P waves with increased amplitude can indicate hypokalemia. P waves with decreased amplitude can indicate hyperkalemia. Bifid P waves (known as P mitrale) indicate left-atrial abnormality - e.g., dilatation or hypertrophy. The absence of the P wave with a flat baseline may indicate atrial fibrillation and Sinoatrial arrest (with a secondary escape rhythm).</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Ventricular activation time (VAT) is the time between the beginnings of the QRS deflection to the peak R. Option B. Atrial diastole: lasting about 0.7 seconds - relaxation of the atria, during which the atria fills with blood from the large veins (the vena cavae). Ventricular diastole: lasts about 0.5 seconds - begins before atrial systole, allowing the ventricles to fill passively with blood from the atria. Option D. Ventricular repolarization is a complex electrical phenomenon that represents a crucial stage in electrical cardiac activity. It is expressed on the surface electrocardiogram by the interval between the start of the QRS complex and the end of the T wave or U wave (QT).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 23 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "Which of the following receptor cells is a primary afferent neuron?", "options": [{"label": "A", "text": "Auditory hair cell", "correct": false}, {"label": "B", "text": "Bitter Taste Cell", "correct": false}, {"label": "C", "text": "Olfactory Receptor Cell", "correct": true}, {"label": "D", "text": "Photoreceptor cell", "correct": false}], "correct_answer": "C. Olfactory Receptor Cell", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Olfactory Receptor Cell Olfactory receptor cells are primary afferent neurons located in the olfactory epithelium within the upper levels of the nasal cavities. They are unusual neurons because they are replaced continually throughout life, turning over every 4 to 8 weeks. Olfactory receptor cells are true to primary afferent neurons that conduct action potentials along their axons into the central nervous system (CNS), where they synapse onto second-order neurons in glomeruli within the olfactory bulb.</p>\n<p><strong>Highyeild:</strong></p><p>The other receptor cells listed are epithelial-derived cells that lack axons. Sensory information from these cells is conveyed by peripheral synapses to axonal terminals of primary afferent neurons that project (often over long distances) into the CNS.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Auditory hair cells, and bitter taste cells are all specialized sensory cells that detect stimuli in the environment, but they are not primary afferent neurons.</p>\n<p><strong>Extraedge:</strong></p><p>Olfactory receptor cells have sensory cilia on an epithelial surface and turn over every few weeks similar to epithelial receptor cells. However, they are true neurons. Odorants are concentrated and presented to olfactory receptor proteins by odorant-binding proteins in the mucus, which also contain antibodies and enzymes. Each olfactory receptor neuron produces only one of a large family of about 10,000 odorant receptor proteins. The olfactory epithelium is also innervated by the trigeminal nerve (cranial nerve V), which contains axons of nociceptive chemoreceptors that have free nerve endings that detect noxious chemicals in the air, such as ammonia and chlorine (as well as components of peppermint and menthol). Activation of these epithelial nociceptors elicits defensive reflexes such as sneezing, lacrimation, and respiratory inhibition.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following statements is true of odorant receptors in olfactory receptor cells?", "options": [{"label": "A", "text": "Most receptors respond to attractive rather than unpleasant odors.", "correct": false}, {"label": "B", "text": "Only one of a family of 10,000 receptor proteins is expressed in each receptor neuron.", "correct": true}, {"label": "C", "text": "Odorant receptor proteins are expressed selectively near synaptic active zones.", "correct": false}, {"label": "D", "text": "Odorant activation of a G protein-coupled receptor directly leads to the opening of K+ channels.", "correct": false}], "correct_answer": "B. Only one of a family of 10,000 receptor proteins is expressed in each receptor neuron.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Only one of a family of 10,000 receptor proteins is expressed in each receptor neuron. Each olfactory receptor neuron expresses only one of 10,000 possible receptor proteins.</p>\n<p><strong>Highyeild:</strong></p><p>Odorant binding to its receptor acts through the G protein Golf in peripheral receptor terminals, leading to the synthesis of cAMP, which opens cAMP-gated cation channels that permit diffusion of Na+, Ca2+, and K+, producing the net effect of depolarization and initiation of action potentials that travel to central synaptic terminals. Each olfactory receptor neuron expresses only one type of odorant receptor, selected from a large pool of receptor genes, and these receptors are distributed randomly among the population of receptor neurons.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A: is incorrect because the response of odorant receptors to specific odors varies widely and is not necessarily biased toward attractive or unpleasant odors. Option C: is incorrect because odorant receptor proteins are not expressed selectively near synaptic active zones. Instead, they are localized to the cilia, the hair-like structures that extend from the olfactory receptor neurons into the mucus layer of the nasal cavity. Option D: is incorrect because odorant activation of a GPCR does not directly lead to the opening of K+ channels. Instead, it activates a cascade of intracellular signaling events that ultimately lead to the opening or closing of ion channels and the generation of an olfactory signal.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 15-year-old girl is brought to the pediatrician’s office because of concern about her development. She has not gone through puberty as have other girls her age. She reports never having had a period or breast development. She also reports that she cannot smell things. She has difficulty recognizing pungent odors such as trash and sweet fragrances such as perfume and flowers. On physical examination, she is sexually infantile without the development of axillary or pubic hair or breast tissue and is unable to perceive odors. The remainder of her examination is normal. She has a cervix and uterus on pelvic examination. The patient subsequently is diagnosed with Kallmann syndrome. What type of axons constitutes the olfactory nerves?", "options": [{"label": "A", "text": "A-alpha myelinated fibers", "correct": false}, {"label": "B", "text": "A-delta myelinated fibers", "correct": false}, {"label": "C", "text": "C Unmyelinated fibers", "correct": true}, {"label": "D", "text": "B myelinated fibers", "correct": false}], "correct_answer": "C. C Unmyelinated fibers", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>C Unmyelinated fibers Types of fibers in the olfactory nerves: Unmyelinated C fibers (slow). This patient presents with Kallmann syndrome. Kallmann syndrome (hypogonadotropic hypogonadism) is a disorder of both olfactory axonal and gonadotropin-releasing hormone (GnRH) neuronal migration from the olfactory placode in the nose. This is why the patient is sexually infantile and has anosmia. The single gene mutation is on the X chromosome and is responsible for functions necessary for neuronal migration.</p>\n<p><strong>Highyeild:</strong></p><p>The olfactory nerves are the nerves responsible for transmitting the sense of smell from the nasal cavity to the brain. They consist of bundles of unmyelinated axons of olfactory receptor neurons, which form the olfactory epithelium in the nasal cavity.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest Options are incorrect only Option C. is correct because the types of fibers in the olfactory nerves are Unmyelinated C fibers (slow).</p>\n<p><strong>Extraedge:</strong></p><p>Kallmann syndrome is a genetic disorder characterized by a failure to start or complete puberty and a decreased or absent sense of smell (anosmia). It is caused by a deficiency or absence of gonadotropin-releasing hormone (GnRH) neurons, which are responsible for the production and release of luteinizing hormone (LH) and follicle-stimulating hormone (FSH) from the pituitary gland. In Kallmann syndrome, the olfactory receptor neurons, which normally express GnRH along with olfactory receptors, fail to migrate properly during development, leading to a deficiency of GnRH neurons and resulting in the clinical features of the syndrome.</p>\n<p><strong>Table:</strong></p><p>Classification Nerve fiber type Nerve fiber subtype Example Relative diameter/Myelination Relative conduction velocity Sensory and Motor A ɑ a motomeurons Large, heavily myelinated Fast ᵝ Touch, pressure Medium, heavily myelinated Moderate у Intrafusal fibers Medium, heavily myelinated Moderate δ Touch, pressure, temperature, fast pain Small, heavily myelinated Moderate B Preganglionic autonomic nerves Small, lightly myelinated Moderate Sensory only C Slow pain, postganglionic autonomic nerves, olfaction Small, unmyelinated Slow a Muscle spindle afferents Large, myelinated Fast l b Golgi tendon organ afferents Large, myelinated Fast ll Secondary afferents of muscle spindles; touch, pressure Medium, myelinated Moderate lll Touch, pressure, fast pain, temperature Small, myelinated Moderate lv Pain, temperature, olfaction Small, unmyelinated Slow</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Taste is mainly a function of the taste buds in the mouth. Individuals can have hundreds of different tastes. These arise by combinations of elementary taste sensations. Report best-suited description about Umami Taste?", "options": [{"label": "A", "text": "The mixture of a sweet and sour taste in food", "correct": false}, {"label": "B", "text": "The mixture of sweet and salty tastes due to glutamate in food", "correct": false}, {"label": "C", "text": "A pleasant taste sensation that is qualitatively different from sour, salty, sweet, or bitter", "correct": true}, {"label": "D", "text": "All incorrect", "correct": false}], "correct_answer": "C. A pleasant taste sensation that is qualitatively different from sour, salty, sweet, or bitter", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>A pleasant taste sensation that is qualitatively different from sour, salty, sweet, or bitter Umami is a Japanese word that means \"pleasant savory taste.\" It is considered the fifth primary taste, in addition to sweet, sour, salty, and bitter. Umami taste is associated with the detection of the amino acid glutamate and its derivatives, such as monosodium glutamate (MSG), which is commonly used as a flavor enhancer in foods.</p>\n<p><strong>Highyeild:</strong></p><p>Umami Taste. Umami, a Japanese word meaning “delicious,” designates a pleasant taste sensation that is qualitatively different from sour, salty, sweet, or bitter. Umami is the dominant taste of food containing l-glutamate, such as meat extracts and aging cheese. The pleasurable sensation of umami taste is thought to be important for nutrition by promoting the ingestion of proteins.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Therefore, option C is the correct description of umami taste, while options A, B, and D are incorrect. Option A. Umami is different from the mixture of sweet and sour tastes in food. Option B . Umami taste is separate from the mixture of Sweet and salty taste due to glutamate in food.</p>\n<p><strong>Extraedge:</strong></p><p>The sensation of taste can be categorized into five basic tastes: sweetness, saltiness, bitterness, sourness, and umami.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Neurologists presented a case of a male patient at age 23 years with manifestations of epigastric discomfort and a sensation of fear, followed by complex partial seizures. Neurologists explained that patients experienced olfactory auras. What are best-suited findings from the below?", "options": [{"label": "A", "text": "Medial temporal lobe epilepsy", "correct": false}, {"label": "B", "text": "The smell of burning rubber", "correct": false}, {"label": "C", "text": "The smell of burning plastic", "correct": false}, {"label": "D", "text": "Both A and B are best suited", "correct": true}], "correct_answer": "D. Both A and B are best suited", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Both A and B are best suited The combination of epigastric discomfort, fear, and complex partial seizures with olfactory auras is a classic presentation of medial temporal lobe epilepsy. The specific smell of burning rubber is a common description of the odor experienced during olfactory auras in this type of epilepsy.</p>\n<p><strong>Highyeild:</strong></p><p>An aura of a disagreeable odor (eg, burning rubber) can occur when an individual experiences an uncinate seizure that originates in the medial temporal lobe. Uncinate fits is a form of temporal lobe epilepsy in which hallucinations of taste and smell and inappropriate chewing movements are prominent features.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option C. Smell of burning plastic, Incorrect finding in uncinate fits.</p>\n<p><strong>Extraedge:</strong></p><p>Olfactory auras (phantosmia) are an infrequent phenome- non in complex focal seizures generated in the mesial temporal lobe. Olfactory auras, consisting of a sudden unexplained sensation of smell, are rare, particularly in compari- son to other auras. They are usually described as unpleasant.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 15 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A 16-year-old, highly allergic girl who is stung by a bee gives herself a shot of epinephrine prescribed by her physician. Because epinephrine activates β-adrenergic receptors, it will relieve the effects of the bee sting by decreasing which of the following?", "options": [{"label": "A", "text": "The contraction of the airway smooth muscle", "correct": true}, {"label": "B", "text": "The strength of ventricular muscle contraction", "correct": false}, {"label": "C", "text": "The rate of depolarization in the SA node", "correct": false}, {"label": "D", "text": "The transport of calcium into skeletal muscle fibers", "correct": false}], "correct_answer": "A. The contraction of the airway smooth muscle", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The contraction of the airway smooth muscle Epinephrine (adrenaline) to reduce the bee sting body's allergic response. This is an example of Anaphylaxis: a generalized immune reaction of the body in the individuals sensitive to the agent that causes the body to enter into anaphylactic shock and puts the individual's life at immediate risk. This can be caused by agents such as toxins in insect bites, vaccines, antibiotics (such as penicillin), and even some foods such as Peanuts. There is the release of inflammatory mediators such as Histamine. These cause bronchoconstriction and increased secretions in the airway leading to mortality.</p>\n<p><strong>Highyeild:</strong></p><p>Adrenaline acts as a physiological antagonist to such endogenous inflammatory mediators by acting on β2 receptors causing bronchodilation and acts on α receptors to decrease secretions. In this case, it acts as a life-saving drug. Epinephrine antagonizes the action of histamine by acting on effector cells in a direction opposite to that of histamine. The so-called antihistaminic drugs block rather than antagonize the action of histamine.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Options: B, C & D. Epinephrine has no effect on the strength of ventricular muscle contraction (B) or the rate of depolarization in the SA node (C). Epinephrine actually increases the transport of calcium into skeletal muscle fibers (D), which can enhance muscle contraction. However, this is not relevant to the relief of the effects of a bee sting.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 35-year-old woman is seen by a neurologist to evaluate her incapacitating muscle weakness. The neurologist suspects myasthenia gravis and decides to confirm his diagnosis by administering a drug that increases the force of muscle contraction in patients with myasthenia gravis. Caution is advised when administering the drug to patients with heart disease because bradycardia may develop. Which of the following most likely explains the ability of the drug to increase the force of muscle contraction in patients with myasthenia gravis?", "options": [{"label": "A", "text": "Increasing the amount of acetylcholine (ACh) released by a motoneurons", "correct": false}, {"label": "B", "text": "Increasing the affinity of the skeletal muscle acetylcholine receptors to acetylcholine", "correct": false}, {"label": "C", "text": "Increasing the motoneuron discharge rate", "correct": false}, {"label": "D", "text": "Decreasing the metabolic breakdown rate of acetylcholine", "correct": true}], "correct_answer": "D. Decreasing the metabolic breakdown rate of acetylcholine", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Decreasing the metabolic breakdown rate of acetylcholine The drug used to test for myasthenia gravis is an acetylcholinesterase inhibitor such as Edrophonium . The drug prevents the breakdown of acetylcholine, increasing the duration of time acetylcholine remains in the synaptic cleft Because acetylcholine can bind to the end-plate receptors for a longer time, the magnitude of the end-plate potential increases, increasing the probability of it generating an action potential.</p>\n<p><strong>Highyeild:</strong></p><p>The greater the action potential force rate, the greater the source of muscle contraction. Increasing the amount of acetylcholine released by the motoneurons, by increasing the affinity of the skeletal muscle receptors for acetylcholine or increasing the discharge rate of a motor neuron could cause a similar effect.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A: Increasing the amount of ACh released by a motoneuron, is not a mechanism of action of acetylcholinesterase inhibitors . Option B: Increasing the affinity of the skeletal muscle acetylcholine receptors to ACh, is also not a mechanism of action of acetylcholinesterase inhibitors . Option C: Increasing the motoneuron discharge rate , may increase the force of muscle contraction , but it is not a mechanism of action of acetylcholinesterase inhibitors .</p>\n<p><strong>Extraedge:</strong></p><p>Myasthenia gravis is an autoimmune disease in which circulating antibodies against the postsynaptic nicotinic acetylcholine receptor destroy the receptors and/or prevent acetylcholine from binding. The disease is more common in women with a male-to-female ratio of 3:2 Extraocular muscles are affected first (ptosis and diplopia occur) followed by weakness of jaws,face and body. Cardinal features are weakness and fatigue which deteriorate with repeated use and improve with sleep and rest. Exacerbations and remissions are common. Diagnosis by Ice-pack test: Improvement in ptosis on keeping ice pack over the eyes is very sensitive. Anti-AChR radioimmunoassay: ~85% positive in generalized MG; Edrophonium chloride (2 mg + 8 mg IV): Edrophonium is a readily acting reversible acetylcholinesterase inhibitor. Inhibition of acetylcholinesterase leads to an increased concentration of acetylcholine in the synapse which leads to improvement in symptoms. An initial IV dose of 2 mg of edrophonium is given. If definite improvement occurs, the test is considered positive and is terminated.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following muscle proteins plays an important role in the contraction of both smooth and striated muscles?", "options": [{"label": "A", "text": "Calmodulin", "correct": false}, {"label": "B", "text": "Troponin", "correct": false}, {"label": "C", "text": "Tropomyosin", "correct": false}, {"label": "D", "text": "Actin", "correct": true}], "correct_answer": "D. Actin", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Actin Actin plays an important role in the contraction of both smooth and striated muscles.</p>\n<p><strong>Highyeild:</strong></p><p>In both smooth and striated muscle, contraction is produced by the cross-bridge cycle in which the cross-bridge on the thick filament binds to the actin molecule on the thin filament. In excitation-contraction coupling in striated muscle, calcium initiates contraction by binding to troponin. The calcium-activated troponin then acts to remove the tropomyosin-mediated inhibition of the actin-myosin interaction. In excitation-contraction coupling in smooth muscle, calcium initiates contraction by binding to calmodulin. The calcium-activated calmodulin then activates the myosin light chain protein kinase enzyme, which phosphorylates the myosin light chains. Actin-myosin interaction follows light-chain phosphorylation.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. calcium initiates contraction by binding to calmodulin. The calcium-activated calmodulin then activates the myosin light chain protein kinase (MLCK) enzyme, which phosphorylates the myosin light chains. Option B. In excitation-contraction coupling in striated muscle, calcium initiates contraction by binding to troponin. Option C. Tropomyosin blocks myosin binding sites on actin molecules, preventing cross-bridge formation, which prevents contraction in a muscle without nervous input.</p>\n<p><strong>Extraedge:</strong></p><p>Smooth muscle contraction is regulated by a series of reactions that begins with the binding of calcium to calmodulin. The calcium-calmodulin complex then binds and activates a protein kinase called myosin light chain kinase (MLCK). MLCK catalyzes the phosphorylation of the myosin light chains (LC20). Once these light chains are phosphorylated, myosin and actin interaction can occur and the muscle shortens and develops tension. Although two molecules of ATP are required to initiate contraction, one for the phosphorylation of myosin light chains and one to bend the myosin cross-bridge, smooth muscle is energetically efficient because the rate of cross-bridge cycling is so slow.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "When comparing the contractile responses in smooth and skeletal muscle, which of the following is most different?", "options": [{"label": "A", "text": "The source of activator calcium", "correct": false}, {"label": "B", "text": "The role of calcium in initiating contraction", "correct": true}, {"label": "C", "text": "The mechanism of force generation", "correct": false}, {"label": "D", "text": "The source of energy used during contraction", "correct": false}], "correct_answer": "B. The role of calcium in initiating contraction", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The role of calcium in initiating contraction The greatest difference in excitation-contraction coupling between skeletal muscle and smooth muscle involves the role of calcium in initiating contraction.</p>\n<p><strong>Highyeild:</strong></p><p>In smooth muscle, calcium binds to and activates calmodulin, which, by activating myosin light chain kinase, catalyzes the phosphorylation of the 20,000-Da myosin light chain (LC20). Once the light chains are phosphorylated, myosin cross-bridges bind to actin on the thin filaments, which initiates contraction. In skeletal muscle, calcium binds to troponin, which removes the tropomyosin-mediated inhibition of the actin-myosin interactions. Once the inhibition is removed, cross-bridge cycling (and contraction) begins. In both smooth and skeletal muscle, the cycling of cross-bridges generates force. ATP provides the energy for the cycling of the cross-bridges in both muscles. In skeletal muscle, activator calcium comes exclusively from the SR, whereas in smooth muscle calcium can come from both the SR and the extracellular fluid.</p>\n<p><strong>Extraedge:</strong></p><p>Comparison of smooth muscle and skeletal muscle contraction:-</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following is true regarding the action potential of skeletal muscle?", "options": [{"label": "A", "text": "It spreads inward to all parts of the muscle via the T-tubules", "correct": true}, {"label": "B", "text": "It has a prolonged plateau phase", "correct": false}, {"label": "C", "text": "It causes the immediate uptake of Ca2+ into the lateral sacs of the sarcoplasmic reticulum", "correct": false}, {"label": "D", "text": "It is longer than the action potential of cardiac muscle", "correct": false}], "correct_answer": "A. It spreads inward to all parts of the muscle via the T-tubules", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>It spreads inward to all parts of the muscle via the T-tubules T-tubules are invaginations of the plasma membrane, which are present exclusively in striated muscle . Their role is to maintain the SR calcium store under the tight control of membrane depolarization via the voltage sensor channel DHPR.</p>\n<p><strong>Highyeild:</strong></p><p>Depolarization of the muscle fiber is essential for initiating muscle contraction. The action potential of skeletal muscle is transmitted to all of the fibrils along T-tubules, triggering the release of Ca2+ from the lateral sacs of the sarcoplasmic reticulum next to the T-system. The electrical events in skeletal muscle and the ionic fluxes underlying them are similar to those in nerves. In contrast, the action potential in cardiac muscle is longer and has a prolonged plateau phase.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options: Option B. This plateau phase allows for a longer muscle contraction and gives time for the nearby cardiac muscle cells to depolarize. Option D. In skeletal muscle cells, the action potential duration is approximately 2-5 ms. In contrast, the duration of cardiac action potentials ranges from 200 to 400 ms .</p>\n<p><strong>Extraedge:</strong></p><p>Action potentials in skeletal muscle cells are longer in duration than action potentials in cardiac muscle cells. The efflux of K+ repolarizes skeletal muscle cells after an action potential, while repolarization in cardiac muscle cells is due to the efflux of Ca2+.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following is true regarding the contractile response of skeletal muscle?", "options": [{"label": "A", "text": "It starts after the action potential is over", "correct": false}, {"label": "B", "text": "It does not last as long as the action potential", "correct": false}, {"label": "C", "text": "It produces more tension when the muscle contracts isometrically than isotonically", "correct": true}, {"label": "D", "text": "It produces more tension when the muscle contracts isotonically than isometrically", "correct": false}], "correct_answer": "C. It produces more tension when the muscle contracts isometrically than isotonically", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>It produces more tension when the muscle contracts isometrically than isotonically Skeletal muscle produces more tension when the muscle contracts isometrically than isotonically. Isometric contractions involve sarcomere shortening and increasing muscle tension.</p>\n<p><strong>Highyeild:</strong></p><p>In isometric (same measure or length) contractions, muscle contraction increases the tension of the muscle. Isometric contraction is possible because muscles have elastic and viscous elements in series with the contractile elements, so contraction can occur without an appreciable decrease in length. In contrast, isotonic (same tension) contractions are contractions against a constant load, which decrease muscle length. Muscle fiber membrane depolarization during an action potential initiates muscle contraction via a process called excitation-contraction The duration of the contractile response of skeletal muscle (muscle twitch) exceeds the duration of the action potential, but varies with muscle fibre type. Because the muscle contractile mechanism does not have a refractory period, repeated stimulation before relaxation causes greater tension development than during a single muscle twitch, a process called summation of contractions.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options: Rest Options are incorrect regarding skeletal muscle features.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following characteristics is the most similar between the capillaries in the skeletal muscle and pulmonary circulations?", "options": [{"label": "A", "text": "The interstitial protein concentration", "correct": false}, {"label": "B", "text": "The interstitial hydrostatic pressure", "correct": false}, {"label": "C", "text": "The capillary oncotic pressure", "correct": true}, {"label": "D", "text": "The capillary hydrostatic pressure", "correct": false}], "correct_answer": "C. The capillary oncotic pressure", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The capillary oncotic pressure Blood flows in series through the systemic and pulmonary circulations, and, therefore, blood perfusing the skeletal muscles has the same oncotic pressure as the blood flowing through the pulmonary circulation.</p>\n<p><strong>Highyeild:</strong></p><p>However, the blood pressure is much lower in the pulmonary circulation than in the systemic circulation, and because the thoracic cavity has negative pressure, the interstitial fluid pressure is more negative in the pulmonary circulation than in the systemic circulation. The pulmonary interstitium is contiguous with the pulmonary lymph vessels, and, therefore, there is a relatively high interstitial concentration of protein in the lungs. Skeletal muscle capillaries are not very permeable to proteins, resulting in low interstitial protein concentration in skeletal muscle.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options: Rest all options are incorrect.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "According to the sliding theory of muscle contraction, which of the following statements is true?", "options": [{"label": "A", "text": "Myosin length reduces", "correct": false}, {"label": "B", "text": "I band becomes wider", "correct": false}, {"label": "C", "text": "A band remains unchanged", "correct": true}, {"label": "D", "text": "The interval between Z lines remains the same", "correct": false}], "correct_answer": "C. A band remains unchanged", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>A band remains unchanged The A-band contains both thick and thin filaments and is the center of the sarcomere that spans the H zone. During contraction , the H-zone, I-band, the distance between Z-lines, and the distance between M-lines all become smaller. However, the A band's size remains constant during contraction.</p>\n<p><strong>Highyeild:</strong></p><p>The process by which the contraction of the muscle is brought about is a sliding of the thin filaments over the thick filaments. Note that this shortening is not due to changes in the actual lengths of the thick and thin filaments, but rather, by their increased overlap within the muscle cell. The width of the A bands is constant, whereas the Z lines move closer together when the muscle contracts and farther apart when it relaxes.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options: Option A. The M line remains in the center of the sarcomere. Option B. Muscle contraction results in both the H-band and I-bands shortening, but the A-band remains the same length (A band is Always the same). Option D. When sarcomere contracts, the Z lines move closer together and the I band becomes</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The diagram provided shows the stages of the sliding filament theory. State the correct order ___ : Select the correct answer from the above code:", "options": [{"label": "A", "text": "5, 3, 2, 7, 8, 6, 4, 1", "correct": false}, {"label": "B", "text": "3, 2, 5, 6, 8, 7, 4, 1", "correct": false}, {"label": "C", "text": "3, 2, 5, 7, 8, 6, 4, 1", "correct": true}, {"label": "D", "text": "8, 6, 4, 1, 3, 2, 5, 7", "correct": false}], "correct_answer": "C. 3, 2, 5, 7, 8, 6, 4, 1", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>3, 2, 5, 7, 8, 6, 4, 1 The correct order of the stages of the sliding filament theory and the correct answer to this question: (3), (2), (5), (7), (8), (6), (4), (1).</p>\n<p><strong>Highyeild:</strong></p><p>When the muscle fiber is relaxed, each myosin head is bound to a molecule of ADP and an inorganic phosphate. The sliding filament theory begins with the release of calcium ions from a specialized organelle in the muscle fiber called the sarcoplasmic reticulum, as described in the statement (3). Calcium ions bind to tropomyosin, causing it to pull away from and expose these myosin binding sites on the actin filament, as described in the statement (2). This allows the myosin heads to temporarily bind to the actin filament, forming cross-bridges, which are otherwise known as transverse links, between the molecules, as described in the statement (5). The formation of these cross-bridges releases the inorganic phosphate molecule from each myosin head. The myosin head then changes angle, pulling the whole actin filament along. This process is sometimes called a power stroke and is described in the statement (7). The power stroke releases the molecule of ADP from each myosin head. This is described in the statement (8). This allows ATP to bind to myosin instead, leading to the breaking of the cross-bridge between the actin and myosin filaments and causing the myosin heads to detach. This is described in the statement (6). The myosin heads are now positioned further along the actin filament than they were before the power stroke due to the actin filament being pulled along. The ATP molecule bound to the myosin head is hydrolyzed to produce ADP and inorganic phosphate. ATP hydrolysis requires an enzyme called ATPase, as described in the statement (4). The hydrolysis of ATP releases the energy needed for the myosin head to be ready for another power stroke and binds to another myosin binding site further along the actin filament. To prepare for this, the myosin head returned to its original position, as described in the statement (1). Now the correct order of the stages of the sliding filament theory and the correct answer to this question: (3), (2), (5), (7), (8), (6), (4), (1).</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest orders are incorrect.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 19 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A 65-year-old man presents to his primary care doctor complaining of difficulties with his vision, particularly at night. The blurred vision is primarily in the right and left peripheral fields. He has myopia and wears corrective lenses. The physical examination reveals visual acuity of 20/100 bilaterally with visual field deficits on the right and left periphery. Where is the cranial lesion that results in bitemporal hemianopia?", "options": [{"label": "A", "text": "Macula", "correct": false}, {"label": "B", "text": "Optic chiasm", "correct": true}, {"label": "C", "text": "Suprachiasmatic nucleus", "correct": false}, {"label": "D", "text": "Optic tract", "correct": false}], "correct_answer": "B. Optic chiasm", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Optic chiasm Lesions that affect the optic chiasm affect both of the peripheral visual fields, sparing the midline visual fields. An example of this type of lesion would be a pituitary tumor that compresses the optic chiasm. A lesion in an optic nerve will result in blindness in the ipsilateral eye, and a lesion in an optic tract will result in homonymous hemianopia.</p>\n<p><strong>Highyeild:</strong></p><p>When there is compression at the optic chiasm, the visual impulse from both nasal retinas are affected, leading to the inability to view the temporal, or peripheral, vision. This phenomenon is known as bitemporal hemianopsia. In the optic chiasm, ganglion cell axons from the nasal half of each retina cross and merge with uncrossed axons from the temporal retina of the contralateral eye so that each optic tract carries information exclusively from the contralateral visual field.</p>\n<p><strong>Extraedge:</strong></p><p>Lesions at different locations along the visual pathway produce characteristic visual deficits. For example, the section of one optic nerve produces complete ipsilateral anopia. A section through the optic chiasm produces heteronymous hemianopia, with loss of vision from the temporal half of each retina. Section of one optic tract produces homonymous hemianopia, with loss of vision from the temporal half of one retina and the nasal half of the other.</p>\n<p><strong>Table:</strong></p><p>Visual\n field defects 1. Right\n anopia (monocular vision loss) 2.\n Bitemporal hemianopia (pituitary lesion, chiasm) 3. Left\n homonymous hemianopia 4. Left\n upper quadrantanopia (right temporal lesion, MCA) 5. Left\n lower quadrantanopia (right parietal lesion, MCA) 6. Left\n hemianopia with macular sparing (right occipital lesion, PCA) 7.\n Central scotoma (eg, macular degeneration Ventral\noptic radiation (Meyer loop)-lower retina; loops around inferior horn of\nlateral ventricle. Dorsal\noptic radiation-superior retina; takes shortest path via internal capsule.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 29-year-old woman who complaints of slowly progressive loss of vision on her right side affecting both eyes are seen by her neurologist. A CT scan demonstrates a high-density space-occupying lesion. The lesion produces the visual field defect by compressing which of the following?", "options": [{"label": "A", "text": "The right lateral geniculate ganglion", "correct": false}, {"label": "B", "text": "The left optic nerve", "correct": false}, {"label": "C", "text": "The right visual cortex", "correct": false}, {"label": "D", "text": "The left optic tract", "correct": true}], "correct_answer": "D. The left optic tract", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The left optic tract The loss of vision on one side of the visual field is called hemianopia. If it affects the same half of the visual field on both eyes, it is called homonymous hemianopia.</p>\n<p><strong>Highyeild:</strong></p><p>Right-sided homonymous hemianopia is caused by a lesion affecting the left visual pathway at the optic tract (part of the pathway that comes after the optic chiasma), where the visual information from the nasal portion of the left retina (the right hemifield of the left eye’s visual field) and the temporal portion of the right retina (the right hemifield of the right eye’s visual field) are carried within the same nerve tract. Bitemporal hemianopia results from more symmetric compression of the optic chiasm, as may occur with pituitary adenoma, meningioma, glioma, or aneurysm.</p>\n<p><strong>Table:</strong></p><p>Visual\n field defects 1. Right\n anopia (monocular vision loss) 2.\n Bitemporal hemianopia (pituitary lesion, chiasm) 3. Left\n homonymous hemianopia 4. Left\n upper quadrantanopia (right temporal lesion, MCA) 5. Left lower\n quadrantanopia (right parietal lesion, MCA) 6. Left\n hemianopia with macular sparing (right occipital lesion, PCA) 7.\n Central scotoma (eg, macular degeneration Ventral\noptic radiation (Meyer loop)-lower retina; loops around inferior horn of\nlateral ventricle. Dorsal\noptic radiation-superior retina; takes shortest path via internal capsule.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 22-year-old man sees his ophthalmologist because it is becoming increasingly difficult for him to read the newspaper. His vision problem most likely results from an inability to contract which of the following?", "options": [{"label": "A", "text": "The iris", "correct": false}, {"label": "B", "text": "The ciliary body", "correct": true}, {"label": "C", "text": "The suspensory ligaments", "correct": false}, {"label": "D", "text": "The extraocular muscles", "correct": false}], "correct_answer": "B. The ciliary body", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The ciliary body Contracting the ciliary body increases the refractive power of the eye for near vision. The ciliary body is a ring-shaped structure located in the eye, just behind the iris. It is responsible for controlling the shape of the lens, which is necessary for focusing on near objects. The ciliary body contracts during the near vision, which causes the suspensory ligaments to relax and the lens to become more spherical, increasing its refractive power.</p>\n<p><strong>Highyeild:</strong></p><p>Hyperopia : In some individuals, the eyeball is shorter than normal, and the parallel rays of light are brought to focus behind the retina. This abnormality is called hyperopia or farsightedness. Corrected by Convex lens Myopia : In myopia (nearsightedness), the anteroposterior diameter of the eyeball is too long and the image is focused in front of the retina. This is corrected by a concave lens. Presbyopia : Gradual loss of accommodation due to age-related decrease in elasticity of the lens. Both near vision and far vision are affected. Bifocal lenses are used in treatment.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A: The Iris: The muscles of the iris control the size of the pupils Option C: The suspensory ligaments: When the ciliary muscle contracts, it pulls the suspensory ligaments toward the cornea, which causes the lens surface to bulge, increasing its refractive power. Option D : The extraocular muscles: the extraocular muscles control the position of the eye in the socket.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 68-year-old man presents with a chief complaint of night blindness (nyctalopia). He is found to have avitaminosis A, which underlies the impairment of rod function. Which of the reactions in the retinal rods is caused directly by the absorption of light energy?", "options": [{"label": "A", "text": "Dissociation of scotopsin and metarhodopsin", "correct": false}, {"label": "B", "text": "Decomposition of scotopsin", "correct": false}, {"label": "C", "text": "Transformation of 11-cis retinal to all-trans retinal", "correct": true}, {"label": "D", "text": "Transformation of metarhodopsin to lumia rhodopsin", "correct": false}], "correct_answer": "C. Transformation of 11-cis retinal to all-trans retinal", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Transformation of 11-cis retinal to all-trans retinal The light-sensitive chemical in the retinal rods is called rhodopsin. It is a combination of 11-cis retinal and opsin.</p>\n<p><strong>Highyeild:</strong></p><p>The first step in the process is the absorption of light by a pigment called rhodopsin, which is located in the outer segment of the rod cells. Rhodopsin consists of a protein called scotopsin and a derivative of vitamin A called 11-cis retinal. When light is absorbed, 11-cis retinal is isomerized to the all-trans-retinal, which triggers a conformational change in scotopsin, leading to the activation of a signaling cascade that ultimately results in the generation of the electrical signal.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest options are incorrect</p>\n<p><strong>Extraedge:</strong></p><p>Avitaminosis A, or vitamin A deficiency, can cause a reduction in the amount of 11-cis retinal available for the formation of rhodopsin, which can impair the ability of the rod cells to respond to light and lead to night blindness (nyctalopia). Therefore, ensuring adequate vitamin A intake is important for the maintenance of normal visual function. Functions of Vitamin A 1- Vision Vitamin A is a component of the visual pigments of rod and cone cells. Rhodopsin, the visual pigment of the rod cells in the retina, (for vision in dim light) consists of 11-cis retinal specially bound to the protein opsin . When rhodopsin is exposed to light, a series of photochemical isomerization occurs, which results in release of all trans retinal and opsin (with bleaching of the visual pigment). This process triggers a nerve impulse that is transmitted by the optic nerve to the brain. Regeneration of rhodopsin requires isomerization of all trans retinal back to 11-cis retinal, which spontaneously combines with opsin to form rhodopsin.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "While seeing a color chart a color-blind male has decreased vision for red light color which appears very light than that of other colors. Which of the following is the likely anomaly in him?", "options": [{"label": "A", "text": "Protanomaly", "correct": true}, {"label": "B", "text": "Deuteranomaly", "correct": false}, {"label": "C", "text": "Tritanomaly", "correct": false}, {"label": "D", "text": "Butanomaly", "correct": false}], "correct_answer": "A. Protanomaly", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Protanomaly Protanomaly is the likely anomaly in the color-blind male described.</p>\n<p><strong>Highyeild:</strong></p><p>Protanomaly is a type of red-green color blindness caused by a genetic mutation affecting the long-wavelength-sensitive (L) cone photopigment on the X chromosome. Individuals with protanomaly have an abnormal version of the L cone photopigment that makes it difficult to distinguish between red and green colors, particularly when a red light is relatively dim. As a result, red colors may appear lighter or washed out compared to other colors.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Deuteranomaly, another type of red-green color blindness, affects the medium-wavelength-sensitive (M) cone photopigment and leads to difficulty distinguishing between red and green colors, particularly when the green light is relatively dim. Tritanomaly is a type of blue-yellow color blindness caused by a genetic mutation affecting the short-wavelength-sensitive (S) cone photopigment. Butanomaly is not a recognized type of color blindness.</p>\n<p><strong>Extraedge:</strong></p><p>Color Blindness Color blindness is an X-linked recessive disease. The most common test for color blindness uses the Ishihara charts, which are plates containing figures made up of colored spots on a background of similarly shaped colored spots</p>\n<p><strong>Table:</strong></p><p>Color affected Color vision decreased Color vision affected Red Protanomaly Protanopia Blue Tritanomaly Tritanopia Green Deuteranomaly Deuteranopia</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 15 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A 53-year-old man presents to his primary care physician with complaints of feeling like the room is spinning, dizziness, decreased hearing, ringing in the ears, and fullness in both ears. He states that the symptoms have been occurring episodically but increasing in frequency. The ringing in his ears was not present initially but has become more prominent. He denies any recent ear infections or trauma. He is not taking any medications. On examination, he is noted to have low-frequency hearing loss. The remainder of the examination is normal. After a complete workup is done, the patient is diagnosed with Ménière disease. What part of the vestibular system detects angular acceleration and rotation?", "options": [{"label": "A", "text": "Semicircular canals", "correct": true}, {"label": "B", "text": "Cochlea", "correct": false}, {"label": "C", "text": "Tubular ducts containing endolymph", "correct": false}, {"label": "D", "text": "Saccule", "correct": false}], "correct_answer": "A. Semicircular canals", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Semicircular canals Angular acceleration and rotation are seen in Semicircular canals. Ménière disease is a syndrome of recurrent attacks of vertigo and tinnitus associated with hearing loss. The underlying pathophysiology is a disorder of fluid balance within the endolymphatic system, leading to the degeneration of vestibular and cochlear hair cells.</p>\n<p><strong>Highyeild:</strong></p><p>Vertigo is a common complaint in the primary care setting. Vertigo can have numerous etiologies, including benign paroxysmal positional vertigo (most common), Ménière disease, toxic damage to the labyrinth (medications), tumors (acoustic neuroma), migraine headaches, viral labyrinthitis, vertebrobasilar vascular disease (especially with cerebrovascular disease), head trauma, and multiple sclerosis.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Only Option A is correct, Semicircular canals detect angular acceleration and rotation.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Otoliths have which of the following properties?", "options": [{"label": "A", "text": "They contain kinocilia and cation channels that are opened when pulled by extracellular filaments.", "correct": false}, {"label": "B", "text": "They are located only in the saccule and utricle.", "correct": true}, {"label": "C", "text": "They are located only in the semicircular canals.", "correct": false}, {"label": "D", "text": "They bend stereocilia toward but not away from the kinocilium.", "correct": false}], "correct_answer": "B. They are located only in the saccule and utricle.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>They are located only in the saccule and utricle. Otoliths are located in the otolithic organs, the saccule and utricle, not in the three semicircular canals. They are pulled by gravity against the gelatinous cap containing stereocilia, which can bend either toward or away from the kinocilium. This bending preferentially transduces linear acceleration rather than angular acceleration (which is transduced by hair cells in the semicircular canals).</p>\n<p><strong>Highyeild:</strong></p><p>Otoliths are tiny structures found in the inner ear of vertebrates that are involved in sensing gravity and linear acceleration. They are composed of calcium carbonate crystals and are located in the utricle and saccule, which are parts of the vestibular system. When the head moves, the otoliths move, and this movement is detected by hair cells located in the utricle and saccule. The hair cells have cilia, including kinocilia, which are sensitive to the movement of the otoliths.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Otoliths are located in the otolithic organs, the saccule and utricle, not in the three semicircular canals.</p>\n<p><strong>Extraedge:</strong></p><p>Hair cells in the saccule and utricle detect the effects of gravity on otoliths, providing information about steady head positions and linear acceleration of the head. Hair cells in the anterior, posterior, and lateral semicircular canals detect inertial forces exerted by the endolymph when the head is rotated, providing information about angular acceleration in three dimensions. Hair cells in different regions of the organ of Corti are activated maximally by different pitches because each pitch produces a traveling wave that peaks at a different position along the cochlea, thus providing an initial tonotopic coding of pitch that is propagated throughout the auditory system.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "At a first-grade parent-teacher conference, the teacher of a 6-year-old boy indicates that the boy seems to have difficulty hearing. His parents take him to the pediatrician, who refers the boy to an otolaryngologist. The boy is found to have a significant hearing deficit accompanying a middle ear infection that also involves the middle ear bones. Which of the following is the primary function of the middle ear bones?", "options": [{"label": "A", "text": "To amplify sounds", "correct": true}, {"label": "B", "text": "To filter high-frequency sounds", "correct": false}, {"label": "C", "text": "To localize a sound", "correct": false}, {"label": "D", "text": "To enhance frequency discrimination", "correct": false}], "correct_answer": "A. To amplify sounds", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>To amplify sounds In the case of the 6-year-old boy with a middle ear infection, the infection likely caused inflammation and fluid buildup in the middle ear, which can interfere with the ability of the ossicles to transmit sound waves effectively. This can result in a significant hearing deficit.</p>\n<p><strong>Highyeild:</strong></p><p>The middle ear consists of three tiny bones, called the ossicles, which are located in the middle ear space. These bones are the malleus (hammer), incus (anvil), and stapes (stirrup). The primary function of the middle ear bones is to amplify sounds from the tympanic membrane (eardrum) and transmit them to the inner ear.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B: to filter high-frequency sounds: there is no such mechanism as filtering of frequencies. The audible range of the human ear is 20 Hertz to 20,000 Hertz. The higher frequencies are heard at the base and the lower frequencies are heard at the apex. Option C: To localize a sound: localizing sound is the function of the external ear Option D : To enhance frequency determination: Cochlea</p>\n<p><strong>Extraedge:</strong></p><p>When sound waves pass from air to water, most of the energy contained in the sound stimulus is lost -The bones of the middle ear significantly reduce the amount of sound loss by amplifying the sound stimulus.</p>\n<p><strong>Table:</strong></p><p>Outer ear Visible portion of ear (pinna), includes auditory canal and tympanic\n membrane. Transfers sound waves via vibration of tympanic membrane. Middle ear Air-filled space with three bones called the ossicles (malleus, incus,\n stapes). Ossicles conduct and amplify sound from tympanic membrane to inner\n ear. Inner ear Snail-shaped, fluid-filled cochlea. Contains basilar membrane that\n vibrates 2° to sound waves. Vibration transduced via specialized hair cells → auditory nerve\n signaling→ brainstem. Each frequency leads to vibration at specific location\n on basilar membrane (tonotopy): Low frequency heard at apex near helicotrema (wide and flexible). High frequency heard best at base of cochlea (thin and\n rigid).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The morning after a rock concert, a 20-year-old college student notices difficulty hearing his professor during a lecture. The physician at the Student Health Center suspects possible damage to his hair cells by the loud music. Depolarization of the hair cells in the cochlea is caused primarily by the flow of which of the following?", "options": [{"label": "A", "text": "K+ into the hair cell", "correct": true}, {"label": "B", "text": "Na+ into the hair cell", "correct": false}, {"label": "C", "text": "Cl– out of the hair cell", "correct": false}, {"label": "D", "text": "Ca2+ into the hair cell", "correct": false}], "correct_answer": "A. K+ into the hair cell", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>K+ into the hair cell The depolarization of hair cells in the cochlea is caused primarily by the flow of positively charged potassium ions (K+) into the hair cells.</p>\n<p><strong>Highyeild:</strong></p><p>When the hair cells are bent, K+ selective channels open, K+ flows into the cell, and the cell depolarizes. This unusual situation occurs because the apical surface of the hair cells, on which the stereocilia are located, is bathed in the endolymph, which contains a high concentration of K+. Moreover, the endolymph is positively charged with respect to the perilymph, which surrounds the basal lateral portion of the hair cell. Because the intracellular concentration of K+ is similar to the extracellular concentration of K+, the electrical gradient determines the direction of K+ flow. Because the endolymph is positively charged and the intracellular fluid is negatively charged, K+ flows into the cell.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. while Na+ ions do enter the hair cells, they are not the primary cause of hair cell depolarization. Option C. The flow of Cl- out of the hair cell during sound stimulation does not cause depolarization of the hair cells. In fact, Cl- efflux from the hair cells plays a critical role in their repolarization, which is essential for proper auditory function. Option D. while Ca2+ ions play an essential role in auditory function, they are not the primary cause of hair cell depolarizatio</p>\n<p><strong>Table:</strong></p><p>Outer ear Visible portion of ear (pinna), includes auditory canal and tympanic\n membrane. Transfers sound waves via vibration of tympanic membrane. Middle ear Air-filled space with three bones called the ossicles (malleus, incus,\n stapes). Ossicles conduct and amplify sound from tympanic membrane to inner\n ear. Inner ear Snail-shaped, fluid-filled cochlea. Contains basilar membrane that\n vibrates 2° to sound waves. Vibration transduced via specialized hair cells → auditory nerve\n signaling→ brainstem. Each frequency leads to vibration at specific location\n on basilar membrane (tonotopy): Low frequency heard at apex near helicotrema (wide and flexible). High frequency heard best at base of cochlea (thin and\n rigid).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 62-year-old man with a history of hypertension and hyperlipidemia is admitted to the hospital for evaluation after demonstrating signs and symptoms of a stroke. Subsequent CT scans, perceptual tests, and a neurological examination provide evidence for impairment of the otolith pathways. The otolith organs (utricle and saccule) are responsible for which of the following?", "options": [{"label": "A", "text": "Producing the vestibular-ocular reflex", "correct": false}, {"label": "B", "text": "Detecting the position of the head in space", "correct": true}, {"label": "C", "text": "Producing rotary nystagmus", "correct": false}, {"label": "D", "text": "Detecting angular acceleration", "correct": false}], "correct_answer": "B. Detecting the position of the head in space", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Detecting the position of the head in space The otolith organs provide information about the position of the head with respect to gravity. When the head is bent away from its normal upright position, otoliths (small calcium carbonate crystals within the utricle and saccule) are pulled downward by gravity. The crystals bend the stereocilia on the hair cells, causing the hair cells to depolarize. Depolarization of the hair cells stimulates the vestibular nerve fibers. Bending the head in different directions causes different otoliths to move. Therefore, the particular group of vestibular nerve fibers that are stimulated signals the direction in which the head bends.</p>\n<p><strong>Highyeild:</strong></p><p>The otolith organs (utricle and saccule) are located in the inner ear and are responsible for detecting linear acceleration and head position with respect to gravity. They contain specialized hair cells that are embedded in a gelatinous matrix, which contains tiny calcium carbonate crystals called otoliths.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. The vestibular-ocular reflex (VOR) is a reflex that allows for the maintenance of stable gaze during head movements. While the otolith organs play a role in this reflex, they are not responsible for producing it. Therefore, Option A (Producing the vestibular-ocular reflex) is not the correct answer. Option C. Rotary nystagmus is an involuntary rhythmic movement of the eyes that occurs when the head is rotated, and it is a manifestation of dysfunction in the vestibular system. However, the otolith organs are not primarily responsible for producing rotary nystagmus. Option D. The detection of angular acceleration is the primary function of the semicircular canals, not the otolith organs. Therefore, Option D (Detecting angular acceleration) is not the correct answer.</p>\n<p><strong>Extraedge:</strong></p><p>Hair cells in the saccule and utricle detect the effects of gravity on otoliths, providing information about steady head positions and linear acceleration of the head. Hair cells in the anterior, posterior, and lateral semicircular canals detect inertial forces exerted by the endolymph when the head is rotated, providing information about angular acceleration in three dimensions. Hair cells in different regions of the organ of Corti are activated maximally by different pitches because each pitch produces a traveling wave that peaks at a different position along the cochlea, thus providing an initial tonotopic coding of pitch that is propagated throughout the auditory system.</p>\n<p><strong>Table:</strong></p><p>Vertigo Sensation\n of spinning while actually stationary. Subtype of \"dizziness,\" but\n distinct from \"lightheadedness.\" Peripheral vertigo is more common\n than central vertigo. Peripheral\n vertigo Due to\n inner ear pathologies such as semicircular canal debris (benign paroxysmal\n positional vertigo), vestibular neuritis, Ménière disease-endolymphatic\n hydrops (↑ endolymph in inner ear) → triad of vertigo, sensorineural hearing\n loss, tinnitus (“men wear vests\"). Findings: mixed horizontal-torsional\n nystagmus (never purely torsional or vertical) that does not change direction\n and is suppressible with visual fixation. Central\n vertigo Brain\n stem or cerebellar lesion (eg, stroke affecting vestibular nuclei,\n demyelinating disease, or posterior fossa tumor). Findings: nystagmus of any\n direction that is not suppressible with visual fixation, neurologic findings\n (eg, diplopia, ataxia, dysmetria)</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 15 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "Experimental gastric function in monitoring in healthy subjects before, during, and after a meal shows an initial rise and then declines in gastric acid production. Which of the following helps most to down-regulate gastric secretions?", "options": [{"label": "A", "text": "Intestinal influences", "correct": true}, {"label": "B", "text": "Basal secretion", "correct": false}, {"label": "C", "text": "Cephalic phase", "correct": false}, {"label": "D", "text": "Gastrin release", "correct": false}], "correct_answer": "A. Intestinal influences", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Intestinal influences Intestinal influences are effective in down-regulating gastric acid secretion after a meal. The inter digestive state is characterized by MMCs initiated by motilin and regulated by local nerves.</p>\n<p><strong>Highyeild:</strong></p><p>The ileum and colon release peptide YY, which binds the receptors on the endocrine histamine-containing cells described as enterochromaffin-like (ECLs). Such binding counteracts the cephalic and gastric phases of acid secretion by inhibiting gastrin-stimulated histamine release from ECLs. Other factors that inhibit acid secretion include somatostatin and prostaglandins.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B: Basal secretion Basal gastric secretion has been defined as the gastric acid secreted in the absence of intentional or avoidable stimuli. Basal gastric secretion is not an important factor in the down regulation of postprandial gastric secretion. Option C: Cephalic phase and option D. Gastrin release. The cephalic and gastric phases both stimulate gastric acid secretion, not to downregulate</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "When the pH level of the stomach lumen decreases to less than 3, the antrum of the stomach releases a peptide that acts in a paracrine fashion to inhibit gastrin release. This peptide is:", "options": [{"label": "A", "text": "Somatostatin", "correct": false}, {"label": "B", "text": "Gastrin-releasing peptide", "correct": false}, {"label": "C", "text": "Gastrin-inhibiting peptide", "correct": true}, {"label": "D", "text": "Vasoactive intestinal peptide", "correct": false}], "correct_answer": "C. Gastrin-inhibiting peptide", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Gastrin-inhibiting peptide The presence of acids leads to the release of gastrin-inhibiting factor/peptide (GIF/GIP) by K- cells of the stomach and duodenum that inhibit gastric HCl secretion and gastric motility and stimulate intestinal secretion.</p>\n<p><strong>Highyeild:</strong></p><p>The glucose-dependent insulinotropic polypeptide (GIP), also known as Gastric inhibitory polypeptide is an inhibiting hormone of the secretin family of hormones. GIP is derived from a 153-amino acid proprotein encoded by the GIP gene and circulates as a biologically active 42-amino acid peptide. It is synthesized by K cells, which are found in the mucosa of the duodenum and the jejunum of the gastrointestinal tract. Gastric inhibitory polypeptide receptors are seven-transmembrane proteins found on beta-cells in the pancreas.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Somatostatin produces predominantly neuroendocrine inhibitory effects across multiple systems. It is known to inhibit GI, endocrine, exocrine, pancreatic, and pituitary secretions, as well as modify neurotransmission and memory formation in the CNS. Option B. Gastrin-releasing peptide is a regulatory human peptide that elicits gastrin release and regulates gastric acid secretion and enteric motor function . Option D. Vasoactive intestinal polypeptide (VIP) is a neuropeptide that functions as a neuromodulator and neurotransmitter. It is a potent vasodilator, regulates smooth muscle activity, epithelial cell secretion, and blood flow in the gastrointestinal tract.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "On a return visit after receiving a diagnosis of functional dyspepsia, a 35- year-old woman reports sensations of early satiety and discomfort in the epigastric region after a meal. These symptoms are most likely a result of:", "options": [{"label": "A", "text": "Malfunction of adaptive relaxation in the gastric reservoir", "correct": true}, {"label": "B", "text": "Elevated frequency of contractions in the antral pump", "correct": false}, {"label": "C", "text": "An incompetent lower esophageal sphincter", "correct": false}, {"label": "D", "text": "Premature onset of the inter digestive phase of gastric motility", "correct": false}], "correct_answer": "A. Malfunction of adaptive relaxation in the gastric reservoir", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Malfunction of adaptive relaxation in the gastric reservoir Adaptive relaxation is a reflex in which the fundus of the stomach dilates in response to small increases in intragastric pressure when food enters the stomach. Receptive relaxation is a reflex in which the gastric fundus dilates when food passes down the pharynx and the esophagus .</p>\n<p><strong>Highyeild:</strong></p><p>In contrast with pressure-induced adaptive relaxation, ganglionic nicotinic transmission is essential in vagally induced relaxation. VIP and CGRP are important neurotransmitters of the inhibitory sensory neuron, which, however, may not mediate both adaptive and receptive relaxations. Disorders of these reservoir functions result in symptoms of early satiety and anorexia, which are the major symptoms of patients with functional dyspepsia.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. Elevated frequency of contractions in the antral pump lead to gastric emptying . Option C. Incompetence of the lower esophageal sphincter allows reflux of gastric contents into the esophagus, causing burning pain like GERD. Option D. Premature onset of the inter digestive phase of gastric motility low gastric emptiness and leads to malnutrition.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following statements is false?", "options": [{"label": "A", "text": "Meissner's plexus is present in submucosa", "correct": false}, {"label": "B", "text": "Myenteric plexus is present between the inner circular and outer longitudinal muscle layer", "correct": false}, {"label": "C", "text": "Muscularis mucosa is associated with peristalsis", "correct": true}, {"label": "D", "text": "Villi are absent in the large intestine", "correct": false}], "correct_answer": "C. Muscularis mucosa is associated with peristalsis", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Muscularis mucosa is associated with peristalsis Muscularis propria is associated with peristalsis and not muscularis mucosa. Contraction of muscularis mucosa alters absorptive and secretive surface area.</p>\n<p><strong>Highyeild:</strong></p><p>Layers of intestinal wall from outside to inside are as follows: Serosa The longitudinal smooth muscle layer The circular smooth muscle layer Submucosa Mucosa</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Meissner's plexus (submucosal plexus) is present in the submucosa. Option B. The myenteric plexus (Auerbach plexus) is present between the inner circular and outer longitudinal muscle l ayers. Option D. Villi are absent in the large intestine but present in the small intestine.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following fluids have the highest daily secretion of potassium?", "options": [{"label": "A", "text": "Bile", "correct": false}, {"label": "B", "text": "Pancreatic secretion", "correct": false}, {"label": "C", "text": "Jejunal secretion", "correct": false}, {"label": "D", "text": "Saliva", "correct": true}], "correct_answer": "D. Saliva", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Saliva The highest daily secretion of K+ is into the saliva.</p>\n<p><strong>Highyeild:</strong></p><p>In the process of formation of saliva, Na* and CI are reabsorbed from the saliva, and K* and HCO3- are secreted into the saliva. But Remember the highest concentration of K+ is in the rectal fluid. Saliva is a complex secretion. 93 % by volume is secreted by the major salivary glands and the remaining 7% is secreted by minor salivary glands. 99 % of saliva is water and the other 1 % is composed of organic and inorganic molecules Saliva plays an important role in maintaining the integrity of oral structures, in personal relationships, in digestion, and in controlling oral infections.</p>\n<p><strong>Extraedge:</strong></p><p>Major components of saliva are: Mucus → serves as a lubricant Amylase → initiates the digestion of starch Lingual lipase → begins digestion of fat Electrolyte solution (Na + , Cl-, K+,HCO3-) → moistens food Proteins and enzymes: Statherins, Proline-rich proteins, histatins, lysozymes, salivary peroxidase Antimicrobial action Lubrication Buffer capacity and remineralization</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A patient presents with anemia and achlorhydria. After evaluation, pernicious anemia is diagnosed. Damage to which of the following cells is responsible for this condition?", "options": [{"label": "A", "text": "Chief cells", "correct": false}, {"label": "B", "text": "Parietal cells", "correct": true}, {"label": "C", "text": "Enterochromaffin cells", "correct": false}, {"label": "D", "text": "Goblet cells", "correct": false}], "correct_answer": "B. Parietal cells", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Parietal cells Pernicious anemia develops due to autoimmune damage to the parietal cells in gastric glands. Parietal cells secrete HCl and intrinsic factor</p>\n<p><strong>Highyeild:</strong></p><p>The parietal cells secrete both HCI and intrinsic factors. Therefore, when the parietal cells are destroyed, both achlorhydria, as well as pernicious anemia, develop Pernicious anemia occurs due to the deficiency of the intrinsic factor of Castle, which is important for the absorption of vitamin B12.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Chief cells secrete Pepsinogen and Gastric lipase . Option C. Enterochromaffin cells secrete Histamine Option D. Goblet cells secrete mucus . These cells are located on the surface of the crypts of Lieberkuhn and the villi of the small intestine.</p>\n<p><strong>Extraedge:</strong></p><p>Cells present in the crypts of Lieberkuhn: Goblet cells (similar to surface cells of the stomach) - secrete mucus that acts as a lubricant and protects the intestinal surface Epithelial cells - secrete succus entericus (intestinal secretion) Paneth cells - secrete lysosomes and defensins (antibacterial substances).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 31-year-old woman takes antacids with and after a meal so that gastric pH does not decrease below pH 6, for peptic ulcer disease. This agent will cause a greater-than-normal secretion of which of the following?", "options": [{"label": "A", "text": "Gastrin", "correct": true}, {"label": "B", "text": "Secretin", "correct": false}, {"label": "C", "text": "Pancreatic Bicarbonate", "correct": false}, {"label": "D", "text": "CCK", "correct": false}], "correct_answer": "A. Gastrin", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Gastrin The ingestion of a meal results in local and vagal reflexes, resulting in the secretion of gastric acid by neurocrine, endocrine, and paracrine pathways. The major endocrine involved is gastrin released from G cells in the antrum. Normally, as gastric acid lowers gastric pH to around 3, somatostatin is secreted by cells located next to the G cells to inhibit further gastrin release. If pH is not allowed to fall, this does not occur and gastrin secretion continues. Normally, gastric contents emptying from the stomach lower intraduodenal pH to levels that result in the secretion of secretin (around 4.5 and less ).</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B & C. If gastric acid is buffered, this does not occur, and so both secretin and pancreatic bicarbonate secretion are decreased. Option D. Protein and lipid breakdown products in the contents induce I cell to release CCK, which acts as an endocrine to induce pancreatic enzyme secretion, contraction of the gallbladder, and relaxation of the sphincter of Oddi (perhaps through a neural reflex as well).</p>\n<p><strong>Extraedge:</strong></p><p>CCK also induces relaxation of the smooth muscle of the orad stomach leading to slow gastric emptying. The release and absorption of glucose induce the release of both GIP and GLP, which act in an endocrine fashion to enhance the release of insulin, another hormone, from the endocrine pancreas. Neural reflexes, and perhaps CCK and other hormones, regulate contractions of the intestine to induce the mixing of contents (segmenting contractions).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Motility recordings in a patient with signs of bacterial overgrowth of the small intestine indicate an abnormal pattern of motility in the fasting state that is characterized by a lack of the normal periodic bursts of gastric and intestinal contractions. This patient is likely to demonstrate abnormal secretion of which of the following hormones?", "options": [{"label": "A", "text": "CCK", "correct": false}, {"label": "B", "text": "Gastrin", "correct": false}, {"label": "C", "text": "Motilin", "correct": true}, {"label": "D", "text": "Secretin", "correct": false}], "correct_answer": "C. Motilin", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Motilin The disorganized motility pattern is the migrating motor complex (MMC), which is highly propulsive. Data indicate that the phase of intens e contractions in the stomach and duodenum is associated with and perhaps initiated by the hormone motilin.</p>\n<p><strong>Highyeild:</strong></p><p>The hormone motilin is released periodically during the inter digestive state and appears to initiate the increasing burst of contractile activity in the stomach and duodenum. The migration of the intense contractile activity aborally along the intestine is coordinated by enteric nerves.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest Options are incorrect in this case. The inter digestive state is characterized by MMCs initiated by motilin and regulated by local nerves.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "During the chewing of a bolus of food, but before swallowing, salivary secretion, gastric secretion, and pancreatic secretion are stimulated by which of the following neurocrine, endocrine, and paracrine mediators?", "options": [{"label": "A", "text": "ACh, gastrin, histamine", "correct": true}, {"label": "B", "text": "ACh, CCK, nitricoxide", "correct": false}, {"label": "C", "text": "Nitric Oxide, vasoactive intestinal polypeptide, histamine", "correct": false}, {"label": "D", "text": "Vasoactive intestinal polypeptide, gastrin, somatostatin", "correct": false}], "correct_answer": "A. ACh, gastrin, histamine", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>ACh, gastrin, histamine During the cephalic phase of digestion, the presence of food in the mouth induces local and vagal neural reflexes, culminating in the release of the neurocrine ACh at the salivary glands, gastric parietal cells, antral gastrin cells, and pancreatic acinar cells. This results in the secretion of saliva, gastric acid, gastrin, and pancreatic enzymes. The hormone gastrin in turn stimulates gastric parietal cells directly and also induces gastric enterochromaffin cells to release histamine, which also stimulates gastric parietal cells in a paracrine manner.</p>\n<p><strong>Highyeild:</strong></p><p>ACh and gastrin do stimulate parietal cells directly, but more important, they act on enterochromaffin-like (ECL) cells to release histamine, which in turn stimulates the parietal cells. The gastric phase accounts for 60% to 70% of the acid secretory response to a meal. Regulation during the cephalic phase is mostly neurocrine. Reflexes initiated by the sight and smell of food as well as the presence of material in the mouth bring about the release of acetylcholine (ACh) at the salivary glands, at acid-secreting (parietal) and pepsin-secreting (chief) cells in the body of the stomach, and at enzyme-secreting (acinar) cells of the pancreas. Vagal neural pathways also initiate the release from antral G cells of the hormone gastrin, which reaches parietal cells through circulation. Thus, salivary (large volume), gastric acid and pepsin (small volumes), and pancreatic enzyme (small volume) secretions are stimulated during this phase.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "After the ingestion of a meal, the pH in the stomach lumen increases in response to the dilution and buffering of gastric acid by the arrival of food. The pH in the stomach lumen in the fasting state is usually between:", "options": [{"label": "A", "text": "1 to 2", "correct": true}, {"label": "B", "text": "4 to 5", "correct": false}, {"label": "C", "text": "6 to 7", "correct": false}, {"label": "D", "text": "9 to 10", "correct": false}], "correct_answer": "A. 1 to 2", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>1 to 2 In the fasting state, the median gastric pH is 1-2, and the median duodenal pH is 6-7. Normally, The pH of gastric acid is 1.5 to 3.5 in the human stomach lumen, a level maintained by the proton pump H+/K+ ATPase.</p>\n<p><strong>Highyeild:</strong></p><p>Secretions of Gastrointestinal tract Type of Secretion Daily Volume (ml) PH Saliva 1000 6.0-7.0 Gastric secretion 1500 1.0-3.5 Pancreatic secretion 1000 8.0-8.3 Bile 1000 7.8 Small intestine secretion 1800 7.5-8.0 Brunner's gland secretion 200 8.0-8.9 Large intestinal secretion 200 7.5-8.0 Total 6700</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The ileum and distal jejunum of a 34-year-old man is ruptured in an automobile accident. The entire ileum and a portion of the jejunum are resected. What is most likely to occur in this man?", "options": [{"label": "A", "text": "Vitamin B12 deficiency", "correct": true}, {"label": "B", "text": "Constipation", "correct": false}, {"label": "C", "text": "Gastric ulcer", "correct": false}, {"label": "D", "text": "Gastroesophageal reflux disease (GERD)", "correct": false}], "correct_answer": "A. Vitamin B12 deficiency", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Vitamin B12 deficiency Vitamin B12 is absorbed in the ileum; this absorption requires intrinsic factor, which is a glycoprotein secreted by parietal cells in the stomach.</p>\n<p><strong>Highyeild:</strong></p><p>The binding of intrinsic factor to dietary vitamin B12 is necessary for attachment to specific receptors located in the brush border of the ileum. Atrophic gastritis is a type of autoimmune gastritis that is mainly confined to the acid-secreting corpus mucosa.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. The gastritis is diffuse, and severe atrophy eventually develops. Ileal resection is likely to cause diarrhea but not constipation. Option C. A gastric ulcer is possible but relatively unlikely. Option D. GERD is caused by gastric acid and bile reflux into the esophagus; mucosal damage and epithelial cell transformation lead to Barrett esophagus, which is a forerunner to adenocarcinoma, a particularly lethal cancer.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 21-year-old woman visits her physician because of nausea, diarrhea, light-headedness, and flatulence. After an overnight fast, the physician administers 50 grams of oral lactose at time zero (indicated by the arrows in the below Image). Which combination is most likely in this patient during the next 3 hours?", "options": [{"label": "A", "text": "A", "correct": false}, {"label": "B", "text": "B", "correct": true}, {"label": "C", "text": "C", "correct": false}, {"label": "D", "text": "D", "correct": false}], "correct_answer": "B. B", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683533531891-QTDY029012IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>B In a patient with lactose intolerance, there is no rise in serum glucose levels but the breath hydrogen and internal methane production would increase because of the metabolism of lactose by the intestinal bacteria. Patients with lactase deficiency cannot digest milk products that contain lactose (milk sugar). The operons of gut bacteria quickly switch over to lactose metabolism, which results in fermentation that produces copious amounts of gas (a mixture of hydrogen, carbon dioxide, and methane). This gas, in turn, may cause a range of abdominal symptoms including stomach cramps, bloating, and flatulence. The gas is absorbed by blood (especially in the colon) and exhaled from the lungs. Blood glucose levels do not increase because lactose is not digested into glucose and galactose in these patients.</p>\n<p><strong>Highyeild:</strong></p><p>Lactose intolerance also called lactase deficiency or hypolactasia, is the inability to digest and metabolize lactose, a sugar found in milk. Lactose intolerance is not an allergy because it is not an immune response but is caused by lactase deficiency. Primary lactase deficiency is a genetically determined absence or decrease in the enzyme is noted. Jejunal morphology is normal. In non caucasian groups, primary lactase deficiency is abnormal in adulthood. Secondary, acquired, or transient lactase deficiency is due to the small intestinal mucosal disease, abnormalities of brush border cells, and transport processes. It is often associated with celiac sprue.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A young man met with a motorbike accident and had an injury to the ileum and jejunum. Therefore, the entire ileum and partial jejunum were resected. Which of the following would the patient suffer from?", "options": [{"label": "A", "text": "Vitamin B12 deficiency", "correct": true}, {"label": "B", "text": "Constipation", "correct": false}, {"label": "C", "text": "Gastric ulcer", "correct": false}, {"label": "D", "text": "Iron deficiency anemia", "correct": false}], "correct_answer": "A. Vitamin B12 deficiency", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Vitamin B12 deficiency Intrinsic factors must be present for adequate absorption of vitamin B12 from the ileum. That is, an intrinsic factor combines with vitamin B12 in the stomach and protects it from being digested and destroyed as it passes into the small intestine .</p>\n<p><strong>Highyeild:</strong></p><p>When the intrinsic factor–vitamin B12 complex reaches the terminal ileum, the intrinsic factor binds with receptors on the ileal epithelial surface, which in turn makes it possible for the vitamin B12 to be absorbed. When the ileum is resected due to any reason, the surface area required for the absorption of Vitamin B12 is compromised leading to deficiency of Vitamin B12.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest Options are ruled out because Intrinsic factor is a protein made in the stomach. It is needed for the absorption of vitamin B12. This type of B12 deficiency anemia is called pernicious anemia.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A mouse with a new genetic mutation is discovered not to have electrical slow waves in the small intestine. What cell type is most likely affected by the mutation?", "options": [{"label": "A", "text": "Enteric neurons", "correct": false}, {"label": "B", "text": "Inhibitory motor neurons", "correct": false}, {"label": "C", "text": "Enterochromaffin-like cells", "correct": false}, {"label": "D", "text": "Interstitial cells of Cajal", "correct": true}], "correct_answer": "D. Interstitial cells of Cajal", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Interstitial cells of Cajal Interstitial cells of the Cajal of the circular muscle are the cell types found in the circular muscle. These are mainly bipolar cells or spindle-shaped cells associated with the long axis of the surrounding smooth muscle cells.</p>\n<p><strong>Highyeild:</strong></p><p>Interstitial cells of the Cajal contribute to several important functions in the GI tract including: Generation of electrical slow wave activity Coordination of pacemaker activity and active propagation of slow waves Transduction of motor neural inputs from the enteric nervous system Mechanosensation to stretch GI muscles. Basic electrical rhythm (BER) is initiated by the interstitial cells of Cajal, stellate mesenchymal pacemaker cells with smooth muscle-like features that send long multiply branched processes into the intestinal smooth muscle. In the stomach and the small intestine, these cells are located in the outer circular muscle layer near the myenteric plexus; in the colon, they are at the submucosal border of the circular muscle layer.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. The enteric neurons regulate the movement of water and electrolytes between the gut lumen and tissue fluid compartments. Option B. Inhibitory motor neurons innervate the gastrointestinal tract and maintain them. Option C. Enterochromaffin-like cells (ECL) secrete histamine.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 25-year-old female Postgraduate student with irritable bowel syndrome (IBS) has an alteration in intestinal motility resulting in fluctuating constipation and diarrhea. Her condition has worsened in the last month as the date scheduled for her examination approached. Which of the following best describes small intestinal motility?", "options": [{"label": "A", "text": "Contractile activity is initiated in response to bowel wall distention", "correct": true}, {"label": "B", "text": "Contractile frequency is constant from the duodenum to the terminal ileum", "correct": false}, {"label": "C", "text": "Migrating motor complexes (MMCs) occur during the digestive period", "correct": false}, {"label": "D", "text": "Vagotomy abolishes contractile activity during the digestive period", "correct": false}], "correct_answer": "A. Contractile activity is initiated in response to bowel wall distention", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Contractile activity is initiated in response to bowel wall distention Contractile activity causes small intestinal motility, Motilin stimulates gastric and small intestine motility, causing undigested food in these regions to move into the large intestine.</p>\n<p><strong>Highyeild:</strong></p><p>Three types of smooth muscle contractions contribute to small intestinal motility—peristalsis, segmental contractions, and tonic contractions. A fourth type of contraction, peristaltic rushes, is very intense peristaltic waves that may occur in intestinal obstruction. The basal electrical rhythm (BER) is the spontaneous rhythmic fluctuation in membrane potential in the smooth muscle along the GI tract. The BER itself rarely causes muscle contraction; contractions occur only during the depolarizing phase of BERs, which function to coordinate the various types of contractile activity.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: B. The BER is initiated by the interstitial cells of Cajal , which, in the small intestine, are located in the outer circular muscle layer near the myenteric plexus. There are an average of approximately 12 BER cycles per minute in the duodenum and proximal jejunum and 8 cycles per minute in the distal ileum. Option: C. During fasting between periods of digestion, cycles of motor activity , called migrating motor complexes (MMCs), migrate from the stomach to the distal ileum. The MMCs immediately stop with the ingestion of food. Option: D. After vagotomy, the contractile activity becomes irregular and chaotic.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 65-year-old man with a history of alcohol abuse presents to the emergency room with severe epigastric pain, hypotension, abdominal distension, and diarrhea with steatorrhea. Serum amylase and lipase are found to be greater than normal, leading to a diagnosis of pancreatitis. The steatorrhea can be accounted for by a decrease in the intraluminal concentration of which of the following pancreatic enzymes?", "options": [{"label": "A", "text": "Amylase", "correct": false}, {"label": "B", "text": "Chymotrypsin", "correct": false}, {"label": "C", "text": "Colipase", "correct": false}, {"label": "D", "text": "Lipase", "correct": true}], "correct_answer": "D. Lipase", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Lipase Enzymes responsible for the digestion of fats are called Lipases.</p>\n<p><strong>Highyeild:</strong></p><p>The process of fat digestion begins in the stomach and is completed in the proximal small intestine, predominately by enzymes synthesized and secreted by the pancreatic acinar cells (Pancreatic Lipase). The major lipolytic pancreatic enzyme is carboxyl esterase, known as lipase. Lipase is secreted as an active enzyme but the complete activity of lipase requires the protein cofactor colipase, as well as an alkaline pH, bile salts, and fatty acids.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: C. Colipase is secreted in an inactive pro-form and is activated in the intestinal lumen by trypsin Option: B. along with chymotrypsin, is an endopeptidase involved in protein digestion. Option: A. Amylase is involved in the digestion of carbohydrates.</p>\n<p><strong>Extraedge:</strong></p><p>Acute pancreatitis is an acute inflammation of the pancreas and is a potentially life-threatening condition. There are two subtypes of acute pancreatitis as described by the Revised Atlanta Classification. Interstitial edematous pancreatitis The vast majority (90-95%) Most often referred to simply as \"acute pancreatitis\" or \"uncomplicated pancreatitis\" Necrotizing pancreatitis:- necrosis develops within the pancreas and/or peripancreatic tissue. Diagnostic criteria Two of the following three criteria are required for the diagnosis: Acute onset of persistent, severe epigastric pain (i.e., pain consistent with acute pancreatitis) Lipase/amylase elevation >3 times the upper limit of normal. Characteristic imaging features on contrast-enhanced CT, MRI, or ultrasound Clinical presentation Classical clinical features include: Acute onset of severe central epigastric pain (over 30-60 min) Poorly localized tenderness and pain Exacerbated by supine positioning Radiates through to the back in 50% of patient Elevation of serum amylase and lipase are 90-95% specific for the diagnosis. (Rare) signs of hemorrhage on the physical examination: Cullen sign: periumbilical bruising Grey-Turner sign: flank bruising</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 46-year-old salesman presents with the chief complaint of intermittent epigastric pain that is relieved by antacids or eating. Gastric analysis reveals that basal and maximal acid outputs exceed normal values. The gastric acid hypersecretion can be explained by an increase in the plasma concentration of which of the following?", "options": [{"label": "A", "text": "Cholecystokinin", "correct": false}, {"label": "B", "text": "Gastrin", "correct": true}, {"label": "C", "text": "Secretin", "correct": false}, {"label": "D", "text": "Somatostatin", "correct": false}], "correct_answer": "B. Gastrin", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Gastrin Increases in basal and maximal acid output are suggestive of inflammation or removal of the proximal small intestine.</p>\n<p><strong>Highyeild:</strong></p><p>Intestinal receptors monitor the composition of Chyme and elicit feedback mechanisms that regulate gastric acid secretion and gastric emptying. The absence of feedback leads to an increased presence of excitatory mediators of gastric function. Gastrin is the primary stimulus of meal-induced acid secretion by the parietal cells. Gastrin is a hormone that is released by G cells in the antrum of the stomach both in response to a specific neurotransmitter released from enteric nerve endings, known as gastrin-releasing peptide (GRP), and also in response to the presence of oligopeptides in the gastric lumen. Gastrin is then carried through the bloodstream to the fundic glands, where it binds to receptors not only on parietal (and likely, chief) cells to activate secretion, but also on so-called enterochromaffin-like cells (ECL cells) that are located in the gland and release histamine. Histamine is also a trigger of parietal cell secretion, via binding to H2 -receptors. Finally, parietal and chief cells can also be stimulated by acetylcholine, released from enteric nerve endings in the fundus.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Options: A, C, D: Somatostatin, vasoactive intestinal peptide, secretin, and cholecystokinin inhibit gastric acid secretion.</p>\n<p><strong>Extraedge:</strong></p><p>Peptic Ulcer Disease Gastric and duodenal ulceration in humans is related primarily to a breakdown of the barrier that normally prevents irritation and autodigestion of the mucosa by the gastric secretions. Infection with the bacterium Helicobacter pylori disrupts this barrier, as do aspirin and other nonsteroidal anti-inflammatory drugs (NSAIDs), which inhibit the production of prostaglandins and consequently decrease mucus and HCO3 − secretion. NSAIDs are widely used to combat pain and treat arthritis. An additional cause of ulceration is prolonged excess secretion of acid. Zollinger–Ellison syndrome: This syndrome is seen in patients with gastrinomas secreting gastrin. These tumors can occur in the stomach and duodenum, but most of them are found in the pancreas. Gastrin causes prolonged hypersecretion of acid, and severe ulcers are produced.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Jitendra, a 28-year-old man presents to the emergency department of AIIMS hospital with a 48-hour bout of diarrhea with steatorrhea. Which of the following best accounts for the appearance of excess fat in the stool?", "options": [{"label": "A", "text": "Decreased bile acid pool size", "correct": true}, {"label": "B", "text": "Increased bile salt reabsorption", "correct": false}, {"label": "C", "text": "Increased colonic microbiota", "correct": false}, {"label": "D", "text": "Increased chylomicron formation", "correct": false}], "correct_answer": "A. Decreased bile acid pool size", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Decreased bile acid pool size A decrease in bile acid pool size results in increased delivery of fats into the colon , which in turn inhibits fat absorption and promotes water secretion.</p>\n<p><strong>Highyeild:</strong></p><p>The major components of the bile acid pool are cholic and chenodeoxycholic acid with lesser amounts of deoxycholic and lithocholic acid and minor amounts of ursodeoxycholic acid.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Options: B, C, D. Steatorrhea is defined as excessive loss of fat in the stool. Numerous pathophysiological situations can cause the loss of excess fat in the stool including a decrease in bile acid pool size, inactivation or decreased intraluminal concentration of pancreatic lipase in the small intestine, decreased intestinal absorptive surface area (such as occurs in celiac sprue), or inability to form chylomicrons (such as in abetalipoproteinemia).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A patient with parotid gland cancer has damage to the glossopharyngeal nerve. As a result, which of the following respiratory reflexes will be impaired?", "options": [{"label": "A", "text": "Hering-Breuer inflation reflex", "correct": false}, {"label": "B", "text": "Juxta pulmonary capillary (J) receptor reflex", "correct": false}, {"label": "C", "text": "Irritant airway reflex", "correct": false}, {"label": "D", "text": "Carotid body chemoreceptor reflex", "correct": true}], "correct_answer": "D. Carotid body chemoreceptor reflex", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Carotid body chemoreceptor reflex The afferent pathway from the carotid body chemoreceptors is Hering's nerve, a branch of cranial nerve IX, the glossopharyngeal nerve. The vagus nerve constitutes the afferent pathway from the aortic chemoreceptors, the J receptors, the irritant airway receptors, and the rapidly adapting stretch receptors mediating the Hering-Breuer inflation reflex.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Herring-Breuer inflation reflex: It is triggered to prevent the over-inflation of the lung. Pulmonary stretch receptors present on the wall of the bronchi and bronchioles of the airways respond to excessive stretching of the lung during large inspirations. Once activated, they send action potentials through large myelinated fibers of the vagus nerve to the inspiratory area in the medulla and apneustic center of the pons. In response, the inspiratory area is inhibited directly and the apneustic center is inhibited from activating the inspiratory area. This inhibits inspiration, allowing expiration to occur. Option B. Juxta pulmonary capillary (J) receptor reflex: Juxtacapillary receptors, J-receptors, or pulmonary C-fiber receptors are sensory nerve endings located within the alveolar walls in juxtaposition to the pulmonary capillaries of the lung, and are innervated by fibers of the vagus nerve. The stimulation of the J-receptors causes a reflex increase in breathing rate and is also thought to be involved in the sensation of dyspnea, the subjective sensation of difficulty breathing. The reflex response that is produced is apnea followed by rapid breathing, bradycardia, and hypotension (pulmonary chemoreflex). Option C. Irritant airway reflex: Rapidly adapting receptors (RARs) occur throughout the respiratory tract from the nose to the bronchi. In the larynx are usually called 'irritant' receptors. They probably cause cough, the expiration reflex, and other laryngeal reflexes: cardiovascular, mucus secretion, bronchoconstrictor, and laryngo constrictor. Those in the trachea and larger bronchi are very mechanosensitive; they cause cough, bronchoconstriction, and airway mucus secretion.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "TRUE about secretin includes all of the following EXCEPT:", "options": [{"label": "A", "text": "It increases the acidity of biliary and pancreatic secretions", "correct": true}, {"label": "B", "text": "It decreases the gastric acid secretion", "correct": false}, {"label": "C", "text": "It decreases gastrin secretion and gastric emptying", "correct": false}, {"label": "D", "text": "Increases flow and velocity of bile", "correct": false}], "correct_answer": "A. It increases the acidity of biliary and pancreatic secretions", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>It increases the acidity of biliary and pancreatic secretions Secretin increases the secretion of bicarbonate by the duct cells of the pancreas and biliary tract. It thus causes the secretion of a watery, alkaline pancreatic juice. Its action on pancreatic duct cells is mediated via cAMP. It also augments the action of CCK in producing pancreatic secretion of digestive enzymes. It decreases the gastric acid secretion and may cause contraction of the pyloric sphincter.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest all statements are true.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Deficiency of which of the following leads to pellagra?", "options": [{"label": "A", "text": "Niacin", "correct": true}, {"label": "B", "text": "Riboflavin", "correct": false}, {"label": "C", "text": "Folic acid", "correct": false}, {"label": "D", "text": "Pantothenic acid", "correct": false}], "correct_answer": "A. Niacin", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Niacin Niacin deficiency causes intense irritation and inflammation of the mucous membranes of the mouth and other portions of the gastrointestinal tract, resulting in many digestive abnormalities that can lead to widespread gastrointestinal hemorrhage in severe cases .</p>\n<p><strong>Highyeild:</strong></p><p>It is possible that this condition results from generalized depression of metabolism in the gastrointestinal epithelium and failure of appropriate epithelial repair. The clinical entity called pellagra and the canine disease called black tongue are caused mainly by niacin deficiency. It causes: Diarrhea, Dementia, and Dermatitis Pellagra is greatly exacerbated in people on a corn diet because corn is deficient in the amino acid tryptophan, which can be converted in limited quantities into niacin in the body.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. Riboflavin, Riboflavin deficiency can cause fatigue, swollen throat, blurred vision, and depression. Option C. Folate deficiency caused by a lack of dietary folate. Option D. Pantothenate deficiency can play a vital role in ACh deficiency, neurodegeneration, myelin loss, and age-related dementias like Huntington’s</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "All of the following are functions of saliva except:", "options": [{"label": "A", "text": "Acts as a lubricant for mastication", "correct": false}, {"label": "B", "text": "It helps in the perception of taste by dissolving", "correct": false}, {"label": "C", "text": "It helps in the digestion of carbohydrates", "correct": false}, {"label": "D", "text": "It helps in the digestion of proteins", "correct": true}], "correct_answer": "D. It helps in the digestion of proteins", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>It helps in the digestion of proteins The salivary gland’s secretion doesn’t have protein digestive enzymes.</p>\n<p><strong>Highyeild:</strong></p><p>Saliva performs several important functions: it facilitates swallowing, keeps the mouth moist, serves as a solvent for the molecules that stimulate the taste buds, aids speech by facilitating movements of the lips and tongue, and keeps the mouth and teeth clean. When food is chewed, it is mixed with saliva, which contains the digestive enzyme ptyalin (α-amylase) secreted mainly by the parotid glands. This enzyme hydrolyzes starch into the disaccharide maltose and other small polymers of glucose that contain three to nine glucose molecules.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest options are true Option A. Acts as a lubricant for mastication Option B. It helps in the perception of taste by dissolving Option C. It helps in the digestion of carbohydrates</p>\n<p><strong>Extraedge:</strong></p><p>Major components of saliva are: Mucus → serves as a lubricant Amylase → initiates the digestion of starch Lingual lipase → begins digestion of fat Electrolyte solution (Na + , Cl-, K+,HCO3-) → moistens food Proteins and enzymes: Statherins, Proline-rich proteins, histatins, lysozymes, salivary peroxidase Antimicrobial action Lubrication Buffer capacity and remineralization</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Hirschsprung disease is due to?", "options": [{"label": "A", "text": "Loss of ganglion cells in the sympathetic chain", "correct": false}, {"label": "B", "text": "Failure of migration of neural crest cells from cranial to caudal direction", "correct": true}, {"label": "C", "text": "Atrophy of longitudinal muscles", "correct": false}, {"label": "D", "text": "Loss of vagal innervation of myenteric plexus", "correct": false}], "correct_answer": "B. Failure of migration of neural crest cells from cranial to caudal direction", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Failure of migration of neural crest cells from cranial to caudal direction It is due to a congenital absence of the ganglion cells in both the myenteric and submucosal plexuses of a segment of the distal colon, as a result of the failure of the normal cranial-to-caudal migration of neural crest cells during the development</p>\n<p><strong>Highyeild:</strong></p><p>Characteristics of Hirschsprung’s disease:- Congenital megacolon is characterized by a lack of ganglion cells/enteric nervous plexuses (Auerbach and Meissner plexuses) in the distal segment of the Due to failure of neural crest cell migration. Associated with loss of function mutations in RET. Presents with bilious emesis, abdominal distention, and failure to pass meconium within 48 hours- chronic constipation. The normal portion of the colon proximal to the aganglionic segment is dilated, resulting in a \"transition zone\". Diagnosed by the absence of ganglion cells on rectal suction biopsy. Treatment of Choice:- Resection.</p>\n<p><strong>Extraedge:</strong></p><p>Characteristics of Hirschsprung’s disease:- Congenital megacolon is characterized by a lack of ganglion cells/enteric nervous plexuses (Auerbach and Meissner plexuses) in the distal segment of the Due to failure of neural crest cell migration. Associated with loss of function mutations in RET. Presents with bilious emesis, abdominal distention, and failure to pass meconium within 48 hours- chronic constipation. The normal portion of the colon proximal to the aganglionic segment is dilated, resulting in a \"transition zone\". Diagnosed by the absence of ganglion cells on rectal suction biopsy. Treatment of Choice:- Resection.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Enzymes from which one of the following can digest carbohydrates, lipids, proteins, and nucleic acids?", "options": [{"label": "A", "text": "Salivary glands", "correct": false}, {"label": "B", "text": "Stomach", "correct": false}, {"label": "C", "text": "Pancreas", "correct": true}, {"label": "D", "text": "Intestine", "correct": false}], "correct_answer": "C. Pancreas", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Pancreas Pancreatic enzymes can digest carbohydrates, lipids, proteins, and nucleic acids rest not. Pancreas is both an endocrine and an exocrine gland, in that it functions to produce endocrine hormones released into the circulatory system (such as insulin, and glucagon), to control glucose metabolism, and also to secrete digestive/exocrine pancreatic juice, which is secreted eventually via the pancreatic duct into the duodenum.</p>\n<p><strong>Extraedge:</strong></p><p>Active site Enzyme Effect on food Mouth Amylase (alpha amylase) Breaks down starches into disaccharides Stomach Pepsin Breaks down proteins into smaller peptides Small intestine (released from pancreas) Pancreatic amylase Continues the breakdown of starch Trypsin Break down peptides into smaller polypeptides and dipeptides Lipase Breaks down fats Small intestine Maltase, sucrose, lactase Converts disaccharides into monosaccharides Peptidase Breaks down dipeptides into amino acids</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The final digestion of proteins to amino acids can occur in the:", "options": [{"label": "A", "text": "Intestinal lumen", "correct": false}, {"label": "B", "text": "Brush border", "correct": false}, {"label": "C", "text": "Inside the intestinal mucosal cell", "correct": false}, {"label": "D", "text": "All of the above", "correct": true}], "correct_answer": "D. All of the above", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>All of the above The final digestion to amino acids occurs in three locations: the intestinal lumen, the brush border, and the cytoplasm of the mucosal cells.</p>\n<p><strong>Highyeild:</strong></p><p>The carboxypeptidases of the pancreas are exopeptidases that hydrolyze the amino acids at the carboxyl ends of the polypeptides. Some free amino acids are liberated in the intestinal lumen, but others are liberated at the cell surface by the aminopeptidases, carboxypeptidases, endopeptidases, and dipeptidases in the brush border of the mucosal cells. Some di- and tripeptides are actively transported into the intestinal cells and hydrolyzed by intracellular peptidases, with the amino acids entering the bloodstream.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "All are true of ileocecal valves except:", "options": [{"label": "A", "text": "It is normally closed and opens only when a peristaltic wave reacts it", "correct": false}, {"label": "B", "text": "It gets opened by gastro ileal reflex", "correct": false}, {"label": "C", "text": "Sympathetic (+) increases its contraction", "correct": false}, {"label": "D", "text": "It is also a part of the gastrocolic reflex where it relaxes", "correct": true}], "correct_answer": "D. It is also a part of the gastrocolic reflex where it relaxes", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>It is also a part of the gastrocolic reflex where it relaxes The ileum is linked to the colon by a structure known as the ileocecal valve , which restricts the reflux of colonic contents, particularly the large numbers of commensal bacteria, into the relatively sterile ileum. The portion of the ileum containing the ileocecal valve projects slightly into the cecum , so that increases in colonic pressure squeeze it shut, whereas increases in ileal pressure open it. It is normally closed. Each time a peristaltic wave reaches it, it opens briefly, permitting some of the ileal Chyme to squirt into the cecum. When food leaves the stomach, the cecum relaxes, and the passage of Chyme through the ileocecal valve increases (gastro ileal reflex). This is presumably a vagal reflex.</p>\n<p><strong>Highyeild:</strong></p><p>The primary functions of the ileocecal valve are to separate ileal and colonic contents, thereby minimizing bacterial colonization of the small intestine, and to regulate the emptying of ileal contents into the colon. The ileocecal valve consists of two muscular layers of the ileum, an upper and lower lip, that are covered by mucosa and protrude into the lumen of the caecum supported by mucosal folds called frenula.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 29-year-old patient with recurrent abdominal pain is found to have multiple duodenal ulcers. After a detailed evaluation, he is diagnosed with Zollinger-Ellison syndrome. Stimulation of which of the following can inhibit gastric secretion in this patient?", "options": [{"label": "A", "text": "Somatostatin", "correct": true}, {"label": "B", "text": "Histamine", "correct": false}, {"label": "C", "text": "Vagal stimulation", "correct": false}, {"label": "D", "text": "Gastrin", "correct": false}], "correct_answer": "A. Somatostatin", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Somatostatin Gastric secretion is inhibited by somatostatin.</p>\n<p><strong>Highyeild:</strong></p><p>Somatostatin inhibits gastric secretion via both direct and indirect pathways: Direct pathway - somatostatin acts directly on the acid-producing parietal cells by binding to receptors on parietal cells that are coupled to adenylyl cyclase via a Gi protein. This inhibits adenylyl cyclase, and cAMP levels are reduced. In this way, somatostatin antagonizes the stimulatory effect of histamine on H+ secretion. Indirect pathway - somatostatin inhibits the release of histamine and gastrin and thus decreasing H+ secretion indirectly.</p>\n<p><strong>Extraedge:</strong></p><p>ZOLLINGER–ELLISON SYNDROME (ZES) Severe peptic ulcer diathesis secondary to gastric acid hypersecretion due to unregulated gastrin release from a non-β cell often well-differentiated neuroendocrine tumor ( gastrinoma ). ZOLLINGER–ELLISON SYNDROME (ZES) Triad:- Pancreatic or duodenal neuroendocrine tumor. Gastric acid hypersecretion. Peptic ulcer disease.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 37 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "Mrs. Bishnoi is undergoing labor, PV examination showed 2-finger cervical dilatation later the contraction got even stronger, and She was 5 fingers cervical dilatation. Name the mechanism by which it occurs:", "options": [{"label": "A", "text": "Negative feedback mechanism", "correct": false}, {"label": "B", "text": "Positive feedback mechanism", "correct": true}, {"label": "C", "text": "Feedforward control", "correct": false}, {"label": "D", "text": "Adaptive control", "correct": false}], "correct_answer": "B. Positive feedback mechanism", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Positive feedback mechanism Many control systems operate within the organs to control the function of individual parts of the organ. Positive feedback can lead to instability in some cases. Initiating stimulus causes more of the same stimulus creating a vicious cycle. Other examples are Blood clotting, LH surge, action potential, etc.</p>\n<p><strong>Highyeild:</strong></p><p>The feedback mechanism is the physiological regulatory system in a living body that works to return the body to the normal internal state or homeostasis. A positive feedback mechanism, as the name suggests, is a pathway that in response to a deviation in the output causes the output to change even more in the direction of the initial deviation.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A: It is a stabilizing mechanism . Majority of control systems work by this mechanism. It helps to maintain homeostasis. E.g. Baroreceptors, temperature control, secretion of hormones, etc Options C and D: Feedforward and adaptive control are the same thing. It is anticipatory control; no stimulus is required e.g., salivation in anticipation of food, wearing woolen clothes before going out in winter, changing stance while climbing stairs, etc.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The next ovulatory cycle after implantation is postponed because of:", "options": [{"label": "A", "text": "High levels of PRL", "correct": false}, {"label": "B", "text": "The production of hCG by trophoblast cells", "correct": true}, {"label": "C", "text": "The production of prostaglandins by the corpus luteum", "correct": false}, {"label": "D", "text": "The depletion of oocytes in the ovary", "correct": false}], "correct_answer": "B. The production of hCG by trophoblast cells", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The production of hCG by trophoblast cells Menstruation normally occurs in a nonpregnant woman about 14 days after ovulation, at which time most of the endometrium of the uterus sloughs away from the uterine wall and is expelled to the exterior. If this should happen after an ovum has been implanted, the pregnancy would terminate. However, this sloughing is prevented by the secretion of human chorionic gonadotropin (hCG) by the newly developing embryonic tissues. hCG also inhibits ovulation.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Higher prolactin levels between 50-100 ng/mL may cause irregular menstrual periods and significantly decrease a woman's fertility. Option C. Prostaglandins in the corpus luteum (CL) reportedly serve as luteotropic and luteolytic agents. Option D. The follicular phase ends with the abrupt elevation of serum LH (and FSH) levels that causes the rupture of the follicle and the release of its mature oocyte (ovulation).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "When does the implant occur?", "options": [{"label": "A", "text": "On day 4 after fertilization", "correct": false}, {"label": "B", "text": "After the endometrium undergoes a decidual reaction", "correct": false}, {"label": "C", "text": "When the embryo is at the morula stage", "correct": false}, {"label": "D", "text": "Only after priming of the uterine endometrium by progesterone and estrogen", "correct": true}], "correct_answer": "D. Only after priming of the uterine endometrium by progesterone and estrogen", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Only after priming of the uterine endometrium by progesterone and estrogen Progesterone prepares the endometrium to receive and nourish a fertilized egg . If pregnancy does not occur, estrogen and progesterone levels decrease. The decrease in progesterone triggers menstruation or the shedding of the lining. Once the lining is completely shed, a new menstrual cycle begins.</p>\n<p><strong>Highyeild:</strong></p><p>The rapidly increasing progesterone secreted by the ovarian corpus luteum; first promotes increasing progesterone receptors on the fallopian tube smooth muscle cells; then the progesterone activates the receptors, exerting a tubular relaxing effect that allows entry of the ovum into the uterus. After reaching the uterus, the developing blastocyst usually remains in the uterine cavity an additional 1 to 3 days before it implants in the endometrium; thus, implantation ordinarily occurs on about the fifth to seventh day after ovulation. Before implantation, the blastocyst obtains its nutrition from the uterine endometrial secretions, called “uterine milk.” When the conceptus implants in the endometrium, the continued secretion of progesterone causes the endometrial cells to swell further and to store even more nutrients. These cells are now called decidual cells, and the total mass of cells is called the decidua.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest Options are not correct because Option A. In humans, the embryo reaches the uterus in the early blastocyst stage, around 6 days after ovulation . At this stage, the embryo consists of 50 to 150 cells (blastomeres) with a fluid-filled cavity (blastocoele). The blastomeres have differentiated into the trophectoderm and the inner cell mass. Option B. Functional and morphological changes that occur within the endometrium to form the decidual lining into which the blastocyst implants. Option C. The zygote travels down the fallopian tube, where it becomes a morula. Once it reaches the uterus, the morula becomes a blastocyst. The blastocyst then burrows into the uterine lining — a process called implantation.</p>\n<p><strong>Extraedge:</strong></p><p>Fertilization occurs in the fallopian tube. The ova remains fertile in the fallopian tube for 12 to 24 hours. Sperms undergo capacitation in the oviduct and remain fertile for up to 48 hours. The blastocyst enters the endometrial cavity on the sixth day, with implantation occurring on the seventh day. Trophoblastic tissue is the driving force for implantation; the presence of the endometrium is not required. The corpus luteum is “rescued” from regression by hCG secreted by the syncytiotrophoblasts. The corpus luteum produces progesterone until about 8 to 10 weeks when the developing placenta can maintain progesterone production. Early secretion of progesterone by the corpus luteum is important in the maintenance of early pregnancy. Prolactin is necessary for milk production, which is maintained after delivery by the infant’s suckling. Oxytocin is necessary for milk ejection.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Upon contact between the sperm head and the zona pellucida, penetration of the sperm into the egg is allowed because of:", "options": [{"label": "A", "text": "The acrosome reaction", "correct": true}, {"label": "B", "text": "The zona reaction", "correct": false}, {"label": "C", "text": "The perivitelline space", "correct": false}, {"label": "D", "text": "Pro nuclei formation", "correct": false}], "correct_answer": "A. The acrosome reaction", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The acrosome reaction The acrosome reaction that occurs after sperm capacitation, is an exocytotic event induced by a Ca++ influx. It plays an essential role during fertilization, by making spermatozoa able to penetrate the zona and capable of fusing with the egg plasma membrane.</p>\n<p><strong>Highyeild:</strong></p><p>Millions of sperm are deposited in the vagina during intercourse. Eventually, 50 to 100 sperms reach the ovum, and many of them contact the zona pellucida. Sperms bind to a sperm receptor in the zona, and this is followed by the acrosomal reaction, that is, the breakdown of the acrosome, the lysosome-like organelle present on the head of the sperm</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. Zona reaction refers to a modification of the zona pellucida in response to fertilization, which alters the solubility and binding properties of the zona pellucida, and leads to a slow block to polyspermy. Mammalian Fertilization. Option C. The perivitelline space of mammalian oocytes changes in size and composition during preimplantation development. Option D. The female pronucleus is the female egg cell once it has become a haploid cell, and the male pronucleus forms when the sperm enters into the female egg. While the sperm develops inside of the male testes , the sperm does not become a pronucleus until it decondenses quickly inside the female egg.</p>\n<p><strong>Extraedge:</strong></p><p>The central zone of the ovary (medulla) contains support structures for the ovary, and the peripheral zone (cortex) contains the follicles and corpora lutea in various stages of development. The follicular phase of the menstrual cycle varies in length among different individuals, whereas the luteal phase is relatively constant (14 days). The predominant hormones in the follicular and luteal phases are estradiol and progesterone, respectively. Elevated peripheral levels of estradiol result in the LH surge by positive feedback on the anterior pituitary. Ovulation is dependent on the preovulatory LH surge.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "What important lactation hormone enhances contraception and inhibits ovulation?", "options": [{"label": "A", "text": "Estrogen", "correct": false}, {"label": "B", "text": "Oxytocin", "correct": false}, {"label": "C", "text": "Progesterone", "correct": false}, {"label": "D", "text": "Prolactin", "correct": true}], "correct_answer": "D. Prolactin", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Prolactin Elevated levels of prolactin during lactation (and other conditions with elevated prolactin, such as prolactinomas, medications , and hypothyroidism) inhibit hypothalamic GnRH secretion, which subsequently inhibits FSH and LH secretion, resulting in anovulation.</p>\n<p><strong>Highyeild:</strong></p><p>Fertilization occurs in the fallopian tube. The ova remains fertile in the fallopian tube for 12 to 24 hours. Sperms undergo capacitation in the oviduct and remain fertile for up to 48 hours. The blastocyst enters the endometrial cavity on the sixth day, with implantation occurring on the seventh day. Trophoblastic tissue is the driving force for implantation; the presence of the endometrium is not required. The corpus luteum is “rescued” from regression by hCG secreted by the syncytiotrophoblasts. The corpus luteum produces progesterone until about 8 to 10 week, when the developing placenta can maintain progesterone production. Early secretion of progesterone by the corpus luteum is important in the maintenance of early pregnancy. Prolactin is necessary for milk production, which is maintained after delivery by the infant’s suckling. Oxytocin is necessary for milk ejection.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Estrogen, Progesterone, and oxytocin induce ovulation, not inhibition.</p>\n<p><strong>Extraedge:</strong></p><p>The central zone of the ovary (medulla) contains support structures for the ovary, and the peripheral zone (cortex) contains the follicles and corpora lutea in various stages of development. The follicular phase of the menstrual cycle varies in length among different individuals, whereas the luteal phase is relatively constant (14 days). The predominant hormones in the follicular and luteal phases are estradiol and progesterone, respectively. Elevated peripheral levels of estradiol result in the LH surge by positive feedback on the anterior pituitary. Ovulation is dependent on the preovulatory LH surge.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Withdrawal of which of the following hormones results in menstruation?", "options": [{"label": "A", "text": "Estradiol", "correct": false}, {"label": "B", "text": "FSH", "correct": false}, {"label": "C", "text": "Progesterone", "correct": true}, {"label": "D", "text": "LH", "correct": false}], "correct_answer": "C. Progesterone", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Progesterone Withdrawal of the hormone progesterone results in sloughing of the endometrium (menstruation). If pregnancy occurs, the corpus luteum is “rescued” and the production of progesterone continues (no menstruation).</p>\n<p><strong>Highyeild:</strong></p><p>During the luteal phase, when progesterone levels are elevated, the uterine glands are coiled and secretory. The phase concerning the endometrium is called secretory. When the corpus luteum regresses and progesterone levels decline, the endometrial mucosa thins and is shed. This thinning is accompanied by necrosis of endometrial blood vessels, leading to spotty hemorrhages and contributing to the menstrual flow.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Low estrogen levels in women can cause symptoms including irregular periods , hot flashes, painful sex, headaches, and mood swings. Option B. lower circulating FSH levels cause a lengthening menstrual cycle. Option D. Low levels of LH can prevent ovulations.</p>\n<p><strong>Extraedge:</strong></p><p>The central zone of the ovary (medulla) contains support structures for the ovary, and the peripheral zone (cortex) contains the follicles and corpora lutea in various stages of development. The follicular phase of the menstrual cycle varies in length among different individuals, whereas the luteal phase is relatively constant (14 days). The predominant hormones in the follicular and luteal phases are estradiol and progesterone, respectively. Elevated peripheral levels of estradiol result in the LH surge by positive feedback on the anterior pituitary. Ovulation is dependent on the preovulatory LH surge.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 16 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "Punctate hemorrhage was found in a 30-year-old male patient after the application of a tourniquet. With dysfunction of what blood cells is it connected?", "options": [{"label": "A", "text": "Neutrophils", "correct": false}, {"label": "B", "text": "Eosinophils", "correct": false}, {"label": "C", "text": "Monocytes", "correct": false}, {"label": "D", "text": "Platelets", "correct": true}], "correct_answer": "D. Platelets", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Platelets Thrombocytopenia means the presence of very low numbers of platelets in the circulating blood. The hemostatic system consists of platelets , coagulation factors , and the endothelial cells lining the blood vessels . Punctate hemorrhage after the application of torniquet is\r\nconnected to platelet dysfunction.</p>\n<p><strong>Highyeild:</strong></p><p>Monocytes are the tools for Innate Immunity. Lymphocytes are tools for Adaptive Immunity. Monocytes develop in the bone marrow and migrate from the bloodstream to tissues, later they become macrophages.</p>\n<p><strong>Random:</strong></p><p>Explanation of incorrect options:- Option A : Neutrophils are responsible for phagocytosis, degranulation, and the release of nuclear material in the form of neutrophil extracellular traps (NETs). Option B : Eosinophils or acidophils are innate immune granulocytes best recognized for their cytotoxic effector functions, causing damage to parasitic pathogens in helminth infections, and to host tissues in allergic diseases. Option C : Monocytes are responsible for the phagocytosis of pathogens and the presentation of antigens to T cells.</p>\n<p><strong>Extraedge:</strong></p><p>The different phenotypes of macrophages: - Name Location Alveolar macrophages Pulmonary alveolus of lungs Adipose tissue macrophages Adipose tissue Kupffer cells Liver Microglia Neural tissue Osteoclasts Bone Sinusoidal lining cells Spleen Histiocytes Connective tissue Giant cells Connective tissue Peritoneal macrophages Peritoneal cavity Macrophage Serosa and lymphoid organs Hofbauer cells Placenta</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "'X' hormone which is circulating in the blood, binds to an extracellular receptor to give an intracellular response. Hormone 'x' most likely should be:", "options": [{"label": "A", "text": "Hydrophilic", "correct": true}, {"label": "B", "text": "Non-polar", "correct": false}, {"label": "C", "text": "Lipophilic", "correct": false}, {"label": "D", "text": "Amphipathic", "correct": false}], "correct_answer": "A. Hydrophilic", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Hydrophilic Circulating hormones are typically water-soluble. They bind to extracellular receptors on the cellular membrane since they are hydrophilic and lipophobic.</p>\n<p><strong>Highyeild:</strong></p><p>Water-soluble hormones are secreted by exocytosis, travel freely in the bloodstream, and bind to cell-surface receptors. Lipid-soluble hormones diffuse across cell membranes, travel in the bloodstream bound to transport proteins, and diffuse through the membrane of target cells .</p>\n<p><strong>Random:</strong></p><p>Explanation of incorrect options: - Option: B. Molecules that have partially charged positive and negative areas are polar and water soluble are polar . So incorrect option. Option: C. Lipophilic can easily pass through the membrane and can directly activate the intracellular mechanism without a membrane transporter or intracellular second messenger system. So incorrect option. Option: D. Amphipathic substances have both hydrophilic and lipophilic properties. So not the correct option.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 45-year-old male patient presented with a significant prolongation of coagulation time, gastrointestinal hemorrhages, and subcutaneous hematomas. TThese symptoms might be explained by the deficiency of which of the following vitamin?", "options": [{"label": "A", "text": "Vitamin A", "correct": false}, {"label": "B", "text": "Vitamin B1", "correct": false}, {"label": "C", "text": "Vitamin B12", "correct": false}, {"label": "D", "text": "Vitamin K", "correct": true}], "correct_answer": "D. Vitamin K", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Vitamin K Vitamin K is necessary for the formation of five of the important clotting factors: prothrombin, Factor VII, Factor IX, Factor X, and protein C. In the absence of vitamin K, subsequent insufficiency of these coagulation factors in the blood can lead to serious bleeding tendencies.</p>\n<p><strong>Highyeild:</strong></p><p>Vitamin K acts as a cofactor for a group of proteins known as the vitamin K-dependent clotting factors (II, VII, IX, and X ) , which are involved in the activation of blood-clotting proteins.</p>\n<p><strong>Random:</strong></p><p>Explanation of incorrect options:- Option: A. Vitamin A deficiency leads to Night blindness, Xerophthalmia, and Bitot spots, and it's the world's leading preventable cause of childhood blindness. Option: B. Vitamin B1 Deficiency is the established cause of alcohol-associated Wernicke–Korsakoff syndrome. Option: C. Deficiency of Vitamin B12 leads to megaloblastic anemia and neurological changes.</p>\n<p><strong>Extraedge:</strong></p><p>Normal Range Prothrombin time - 11-15 sec INR - 0.9 -1.3 APTT 25-40 sec Thrombin time - <24 sec Fibrinogen - 1.5- 4.5 g/L</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "An 18-year-old boy after an illness has diminished function of protein synthesis in the liver as a result of vitamin K deficiency. It will cause disturbance of:", "options": [{"label": "A", "text": "Anticoagulant generation", "correct": false}, {"label": "B", "text": "Erythropoietin secretion", "correct": false}, {"label": "C", "text": "Erythrocyte sedimentation rate", "correct": false}, {"label": "D", "text": "Blood coagulation", "correct": true}], "correct_answer": "D. Blood coagulation", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Blood coagulation Vitamin K is necessary for the liver formation of five of the important clotting factors: prothrombin, Factor VII, Factor IX, Factor X, and protein C .</p>\n<p><strong>Random:</strong></p><p>Explanation of incorrect options :- Option: A. :- Anticoagulant generation can be vitamin k independent, so it’s incorrect. Option: B. :- Erythropoietin secretions are in response to cellular hypoxia, not vitamin k Deficiency, so it’s ruled out. Option: c. :- Erythrocyte sedimentation rate acceleration is not a significant sign of vitamin k deficiency, so it’s ruled out.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 41-year-old male patient, after pancreatic surgery, developed hemorrhagic syndrome with disturbed 3rd stage of blood clotting. What will be the most likely mechanism of the hemostatic disorder?", "options": [{"label": "A", "text": "Decrease of prothrombin synthesis", "correct": false}, {"label": "B", "text": "Decrease of fibrinogen synthesis", "correct": false}, {"label": "C", "text": "Fibrinolysis activation", "correct": true}, {"label": "D", "text": "Fibrin-stabilizing factor deficiency", "correct": false}], "correct_answer": "C. Fibrinolysis activation", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Fibrinolysis activation Blood clotting has 3 stages – Vascular-platelet hemostasis (pre-phase of clotting); Coagulation hemostasis (consisting of prothrombinase generation, formation of thrombin, and formation of fibrin), Clot retraction and fibrinolysis (after-phase of clotting).</p>\n<p><strong>Highyeild:</strong></p><p>Due to large trauma of tissues during operations in the abdominal cavity, the coagulation cascade is activated and the widespread clotting triggers a significant increase of fibrinolytic system activity that may lead to hemorrhages in the postoperative period.</p>\n<p><strong>Random:</strong></p><p>Explanation of incorrect options:- Option: A. Decrease of prothrombin (factor II) synthesis is a vitamin K–dependent coagulation So it's an incorrect answer. Option: B . Decrease of fibrinogen synthesis results in the prolongation of the prothrombin and activated partial thromboplastin time . So it's an incorrect answer. Option: D . FACTOR XIII (Fibrin Stabilizing Factor) Deficiency, inherited autosomal recessive disorder which is dysfunction in stabilizing the formation of a blood clot.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The blood in the vessels normally does not clot because:", "options": [{"label": "A", "text": "Vitamin K antagonists are present in plasma", "correct": false}, {"label": "B", "text": "Thrombin has positive feedback on plasminogen", "correct": false}, {"label": "C", "text": "Sodium citrate in plasma chelates calcium ions", "correct": false}, {"label": "D", "text": "Vascular endothelium is smooth and coated with glycocalyx", "correct": true}], "correct_answer": "D. Vascular endothelium is smooth and coated with glycocalyx", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Vascular endothelium is smooth and coated with glycocalyx Blood normally does not clot because Endothelial vessels are smooth and coated with glycocalyx.</p>\n<p><strong>Highyeild:</strong></p><p>The most important factors for preventing clotting in the normal vascular system are:- The smoothness of the endothelial cell surface, prevents contact activation of the intrinsic clotting system; A layer of glycocalyx on the endothelium (glycocalyx is a mucopolysaccharide adsorbed to the surfaces of the endothelial cells), repels clotting factors and platelets, thereby preventing activation of clotting; and A protein bound with the endothelial membrane, thrombomodulin, binds the thrombin.</p>\n<p><strong>Random:</strong></p><p>Explanation of incorrect options:- Option: A . Vitamin K antagonists (VKAs) have been the only oral anticoagulants, so it's an incorrect statement. Option: B. Thrombin stimulation of platelets induces plasminogen activation mediated by endogenous urokinase-type plasminogen activator. so it’s ruled out. Option: C. Citrate chelates free calcium ions preventing them from forming a complex with tissue factor and coagulation factor VIIa to promote the activation of coagulation factor X12.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following statement is incorrect?", "options": [{"label": "A", "text": "Factor X is common to both extrinsic and intrinsic pathway", "correct": false}, {"label": "B", "text": "Calcium is essential for the coagulation pathway", "correct": false}, {"label": "C", "text": "Negatively charged surface proteins are required for activation of the extrinsic pathway", "correct": true}, {"label": "D", "text": "Intrinsic pathway can occur in vitro", "correct": false}], "correct_answer": "C. Negatively charged surface proteins are required for activation of the extrinsic pathway", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Negatively charged surface proteins are required for activation of the extrinsic pathway Negatively charged surface proteins doesn’t required for activation of extrinsic pathway ;</p>\n<p><strong>Highyeild:</strong></p><p>The extrinsic system is triggered by the release of tissue thromboplastin, a protein-phospholipid mixture that activates factor VII. Tissue thromboplastin and factor VII activate factors IX and X. In the presence of PL, Ca2+, and factor V, activated factor X catalyzes the conversion of prothrombin to thrombin. The extrinsic pathway is inhibited by a tissue factor pathway inhibitor that forms a quaternary structure with tissue thromboplastin (TPL), factor VIl a, and factor Xa.</p>\n<p><strong>Random:</strong></p><p>Explanation of incorrect options:- Option: A. Factor X is common to both extrinsic and intrinsic pathways: Factor X can be activated by either of two systems, known as intrinsic and extrinsic. Option: B . Calcium is essential for the coagulation pathway: The fibrin is initially a loose mesh of interlacing strands. It is converted by the formation of covalent cross-linkages to a dense, tight aggregate (stabilization). This later reaction is catalyzed by activated factor XIII and requires Ca2+. Option: D. Intrinsic pathway can occur in vitro: The exposure of blood to negatively charged surfaces (e.g., interaction with glass in vitro) initiates the intrinsic pathway leading to the activation complex of factor XII, high-molecular-weight kininogen (HMWK), and prekallikrein (PK).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 25-year-old woman presents to the Clinic for evaluation of abnormal menstrual periods. Her periods last from 7 to 9 days requiring up to 10 pads a day (excessive), she admits to easy bruising (as shown in the image below) and nosebleeds. Family history reveals that her mother has had similar problems. On further examination, a diagnosis was made of Von Willebrand disease (VWD). To which protein does Von Willebrand factor normally bind on the surface of platelets?", "options": [{"label": "A", "text": "Adenosine diphosphate", "correct": false}, {"label": "B", "text": "Glycoprotein 2b", "correct": true}, {"label": "C", "text": "Platelet factor 3", "correct": false}, {"label": "D", "text": "Thromboxane A2", "correct": false}], "correct_answer": "B. Glycoprotein 2b", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683531817819-QTDY001008IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Glycoprotein 2b Glycoprotein 2b also called CD42 is a membrane receptor that binds Von Willebrand factor allowing platelet adhesion and platelet plug formation at sites of vascular injury. So the correct answer is option B. The most common signs of von Willebrand disease (VWD) include nosebleeds and hematomas.</p>\n<p><strong>Highyeild:</strong></p><p>Von Willebrand disease (VWD) :- Most common inherited bleeding disorder of primary hemostasis. Defective platelet function with normal platelet count. Lab results show Abnormal PFA-100 test, ↓ factor VIII activity, ↓ vWF, ↓ platelet aggregation, presence of ristocetin and PTT prolonged. Sign and Symptoms:- Spontaneous mucosal, cutaneous bleeding (e.g. epistaxis, easy bruising, excessive bleeding from wounds, bleeding gums), Menorrhagia, GI bleeding, Internal/joint bleeding, etc.</p>\n<p><strong>Random:</strong></p><p>Explanation of incorrect options :- Option: A. - ADP strengthens the platelet plug by inducing platelet aggregation. Option: C. - platelet factor 3 is derived from platelets and required for the conversion of prothrombin to thrombin. Option: D. - Thromboxane A2 is derived from platelets and promotes platelet aggregation.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following promotes platelet aggregation?", "options": [{"label": "A", "text": "Adenosine triphosphate", "correct": false}, {"label": "B", "text": "Interleukin", "correct": false}, {"label": "C", "text": "Thromboxane A2", "correct": true}, {"label": "D", "text": "Thrombin", "correct": false}], "correct_answer": "C. Thromboxane A2", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Thromboxane A2 Thromboxane A2 (TXA2) produced by activated platelets during hemostasis and has prothrombotic properties that stimulate the activation of new platelets as well as increase platelet aggregation.</p>\n<p><strong>Highyeild:</strong></p><p>In the physiological state, thromboxane A2 (TXA2), together with prostacyclin (PGI2), maintains vascular homeostasis and platelet aggregation. PGI2 is a vasodilator and platelet aggregation inhibitor, and TXA2 is a vasoconstriction and platelet aggregation promoter.</p>\n<p><strong>Random:</strong></p><p>Explanation of incorrect options:- Option: A . ATP Doesn’t cause platelet aggregation but ADP does. ADP not only causes primary aggregation of platelets but is also responsible for the secondary aggregation induced by ADP and other agonists. Option: B . The primary function of interleukins is to modulate growth, differentiation, and activation during inflammatory and immune responses. Not platelet aggression. Option: D . Thrombin is a potent platelet activator, not a direct platelet aggregator.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 19 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A patient suffers a severe hemorrhage resulting in a lowered mean arterial pressure. Which of the following would be elevated above normal levels?", "options": [{"label": "A", "text": "Splanchnic blood flow", "correct": false}, {"label": "B", "text": "Cardiopulmonary receptor activity", "correct": false}, {"label": "C", "text": "Right ventricular end-diastolic volume", "correct": false}, {"label": "D", "text": "Heart rate", "correct": true}], "correct_answer": "D. Heart rate", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Heart rate The decrease in arterial pressure after hemorrhage, as well as decreases in pressures in the pulmonary arteries and veins in the thorax, cause powerful sympathetic reflexes and will cause an Increased Heart Rate.</p>\n<p><strong>Highyeild:</strong></p><p>These Sympathetic reflexes stimulate the sympathetic vasoconstrictor system in most tissues of the body, resulting in three important effects: The arterioles constrict in most parts of the systemic circulation, thereby increasing the total peripheral resistance. The veins and venous reservoirs constrict, thereby helping to maintain adequate venous return despite diminished blood volume. Heart activity increases markedly, sometimes increasing the heart rate from the normal value of 72 beats/min to as high as 160 to 180 beats/min.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- A patient suffering from a severe hemorrhage resulting in a lowered mean arterial pressure (MAP) would activate several compensatory mechanisms in an attempt to maintain adequate blood flow to vital organs. One such mechanism is the activation of the sympathetic nervous system. This would result in an increase in heart rate (HR) as well as an increase in the activity of cardiopulmonary receptors. Rest factor not.</p>\n<p><strong>Extraedge:</strong></p><p>Mean arterial pressure (MAP) is the product of cardiac output (CO) and total peripheral vascular resistance (TPR). CO is the product of heart rate (HR) and stroke volume (SV); changes in either of these parameters also influence MAP.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "In the tube in the diagram, the inlet pressure is 75 mm Hg and the outlet pressure at A and B is 25 mm Hg. Flow is 100 mL/min. The resistance to flow is? (PRU: Peripheral Resistance Unit)", "options": [{"label": "A", "text": "2 PRU", "correct": false}, {"label": "B", "text": "0.5 PRU", "correct": true}, {"label": "C", "text": "2 (mL/min)/mm Hg", "correct": false}, {"label": "D", "text": "0.75 mm Hg/(mL/min)", "correct": false}], "correct_answer": "B. 0.5 PRU", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683532060508-QTDY009002IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>0.5 PRU If the pressure difference between two points is 1 mm Hg and the flow is 1 ml/ sec, the resistance is said to be 1 peripheral resistance unit, usually abbreviated PRU. Resistance =50/100 =0.5PRU.</p>\n<p><strong>Highyeild:</strong></p><p>Resistance is the impediment to blood flow in a vessel, but it cannot be measured by any direct means. Instead, resistance must be calculated from measurements of blood flow and the pressure difference between two points in the vessel.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest options values are incorrect .</p>\n<p><strong>Extraedge:</strong></p><p>(PVR: Pulmonary vascular resistance; SVR: Systemic vascular resistance).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following graphs represents the correct relationship between mean arterial BP and plasma vasopressin(pmol/L) Abscissa= mean arterial BP; Ordinate= plasma vasopressin:", "options": [{"label": "A", "text": "a", "correct": false}, {"label": "B", "text": "b", "correct": false}, {"label": "C", "text": "c", "correct": true}, {"label": "D", "text": "d", "correct": false}], "correct_answer": "C. c", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683532060568-QTDY009003IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>c Curve C shows the relation of mean arterial blood pressure to plasma vasopressin.</p>\n<p><strong>Highyeild:</strong></p><p>There is an inverse relationship between the rate of Vasopressin secretion and the rate of discharge in afferents from stretch receptors in the low- and high-pressure portions of the vascular system. The low-pressure receptors are those in the great veins, right, and left atria and pulmonary vessels; the high-pressure receptors are those in the carotid sinuses and aortic arch.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A and Option B : Both these graphs show a linear relationship which is not correct. Option: D : It is a logarithmic graph and does not depict the inverse relationship between the two.</p>\n<p><strong>Extraedge:</strong></p><p>THERAPEUTIC HIGHLIGHTS Patients with inappropriate hypersecretion of vasopressin have been successfully treated with demeclocycline, an antibiotic that reduces the renal response to vasopressin. The syndrome of “inappropriate” hypersecretion of antidiuretic hormone (SIADH) occurs when vasopressin is inappropriately high relative to serum osmolality.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 55-year-old man comes to his primary care clinician complaining of erectile dysfunction. He is given a prescription for Viagra, and on follow-up, reports that his ability to sustain an erection has been improved markedly by this treatment. The action of which of the following vasoactive mediators would primarily be increased in this patient?", "options": [{"label": "A", "text": "Histamine", "correct": false}, {"label": "B", "text": "Endothelin-1", "correct": false}, {"label": "C", "text": "Prostacyclin", "correct": false}, {"label": "D", "text": "Nitric oxide", "correct": true}], "correct_answer": "D. Nitric oxide", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Nitric oxide The action of nitric oxide would be prolonged in this patient.</p>\n<p><strong>Highyeild:</strong></p><p>Sildenafil (sold under the brand name Viagra) inhibits PDE-5, increasing cyclic guanosine monophosphate cGMP to allow smooth-muscle relaxation by prolonging the action of NO. It is used for erectile dysfunction. Penile erection is also produced by the release of NO, with consequent vasodilation and engorgement of the corpora cavernosa. This accounts for the efficacy of drugs such as Viagra that slow the breakdown of cGMP.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. The answer is not A. Histamine. Nitric oxide (NO) is primarily responsible for the relaxation of smooth muscle cells in blood vessels, and it is the primary mediator of penile erection. Histamine is not involved in this process. Option: B. The answer is not B. Endothelin-1. Endothelin-1 is a potent vasoconstrictor, and it would not be responsible for the i mprovement in erectile function observed in the patient taking Viagra. Option: C. The answer is not C. Prostacyclin. Prostacyclin is a vasodilator and an inhibitor of platelet aggregation , but it is not directly involved in the mechanism of action of Viagra.</p>\n<p><strong>Extraedge:</strong></p><p>Sildenafil is absolutely contraindicated in patients taking any long-acting nitrates or using short-acting nitrates because of the risk of developing potentially life-threatening hypotension. All patients taking organic nitrates, even if they have not asked for Viagra, should be informed about the nitrate-sildenafil hypotensive interaction. Similarly, patients must be warned of the contraindication of taking sildenafil in the 24-hour time interval after taking a nitrate preparation, including sublingual nitroglycerin. Sildenafil is used for the treatment of pulmonary arterial hypertension.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The data below are from an athletic,70-kg man during heavy exercise. Which statement is correct? Oxygen consumption: 4 L/min Arterial oxygen 19 mL/100 mL content: blood Mixed venous oxygen 3 mL/100 mL content: blood Heart rate: 180 beats/min.", "options": [{"label": "A", "text": "Cardiac output is 12 L/min", "correct": false}, {"label": "B", "text": "Cardiac output is 25 L/min", "correct": true}, {"label": "C", "text": "Stroke volume is 67 mL", "correct": false}, {"label": "D", "text": "Stroke volume is 100 mL", "correct": false}], "correct_answer": "B. Cardiac output is 25 L/min", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Cardiac output is 25 L/min The cardiac output can be calculated by the following formula:- So, arterial oxygen =19ml/100ml =0.19ml/min Venous oxygen =3 ml/100ml =0.03ml/min Cardiac output= 4 I/min / (0.19-0.03 I/min) =4/0.16 =25 L/min Also, HR=180 bpm Since Cardiac output= Heart Rate x Stroke volume SV=CO/HR SV=25000/180 =139 mL</p>\n<p><strong>Highyeild:</strong></p><p>Fick’s procedure for measuring cardiac output in humans: mixed venous blood is usually obtained through a catheter inserted up the brachial vein of the forearm, through the subclavian vein, down to the right atrium, and, finally, into the right ventricle or pulmonary artery. Systemic arterial blood can then be obtained from any systemic artery in the body. The rate of oxygen absorption by the lungs is measured by the rate of disappearance of oxygen from the respired air, using any type of oxygen meter.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 30-year-old pregnant lady. At the 34th week of gestation complained of light-headedness at bedtime. Her blood pressure when standing is 125/85 mmHg and 80/60 mmHg when supine. How will you proceed further?", "options": [{"label": "A", "text": "Give Antihypertensives", "correct": false}, {"label": "B", "text": "Ask the patient to follow the lateral recumbent position during bedtime", "correct": true}, {"label": "C", "text": "Restrict the salt diet for the patient", "correct": false}, {"label": "D", "text": "Give electric stimulation of the baroreceptors", "correct": false}], "correct_answer": "B. Ask the patient to follow the lateral recumbent position during bedtime", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Ask the patient to follow the lateral recumbent position during bedtime The lateral recumbent position will increase Cardiac output and Increase BP reducing supine position-induced hypotension as compared to Supine and headaches will reduce.</p>\n<p><strong>Highyeild:</strong></p><p>Supine Hypotension Syndrome can occur in pregnant females when the pregnant mother is in a supine position because there is reduced preload (Venous Return) due to Inferior Vena Cava compression by the enlarged uterus. Reduced venous return can lead to reduced cardiac output which can lead to Hypotension and syncopal attack. Cardiac output is affected by preload and afterload. Reduced preload will lead to reduced cardiac output.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- This is a case of Positioning induced hypertension during her pregnancy so other tactics will not do until she is recovered from Changing sleep positions.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "What is shown in the below?", "options": [{"label": "A", "text": "Hagen-Poiseuille’s principle", "correct": false}, {"label": "B", "text": "Stewart-Hamilton principle", "correct": false}, {"label": "C", "text": "Bernoulli's principle", "correct": true}, {"label": "D", "text": "Universal gas equation", "correct": false}], "correct_answer": "C. Bernoulli's principle", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Bernoulli's principle This image shows Bernoulli's principle. Bernoulli's principle is a law in fluid mechanics, it describes the behavior of fluid moving along a stable, non-viscous, and incompressible streamline.</p>\n<p><strong>Highyeild:</strong></p><p>Bernoulli’s principle. When fluid flows through the narrow portion of the tube, the kinetic energy of the flow is increased as the velocity increases, and the potential energy is reduced. Consequently, the measured pressure (P) is lower than it would have been at that point if the tube had not been narrowed. The dashed line indicates what the pressure drop due to frictional forces would have been if the tube had been of uniform diameter.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Hagen-Poiseuille's principle, also known as Poiseuille's law, is a fundamental principle in fluid mechanics that describes the flow of a viscous fluid through a cylindrical pipe. Option: B. The Stewart-Hamilton principle, also known as the Hamilton's principle of stationary action or the principle of least action, is a fundamental principle in classical mechanics that is used to derive the equations of motion of a physical system. Option: D. The universal gas equation, also known as the ideal gas law, is a fundamental law in physics that describes the behavior of ideal gasses. It relates the pressure, volume, temperature, and number of moles of an ideal gas in a closed system.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 37-year-old woman undergoes a CT scan of the abdomen, which reveals a large peritoneal mass. A subsequent magnetic resonance angiography study showed that the abdominal aorta was constricted to one-half of its resting diameter. As a result, resistance to blood flow through the vessel would be which of the following?", "options": [{"label": "A", "text": "Decreased in half", "correct": false}, {"label": "B", "text": "Decreased 16-fold", "correct": false}, {"label": "C", "text": "Increased by 50%", "correct": false}, {"label": "D", "text": "Increased 16-fold", "correct": true}], "correct_answer": "D. Increased 16-fold", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Increased 16-fold According to Poiseuille's law, resistance is inversely proportional to the fourth power of the radius. Therefore, if the radius of a blood vessel is decreased by a factor of 2, the resistance to blood flow would increase by a factor of 16, or by 16 times.</p>\n<p><strong>Highyeild:</strong></p><p>Viscosity in anemia. Q∞r4 R∞ 1/r4 Capillaries have the highest total cross-sectional area and lowest flow velocity. Pressure gradient drives flow from high pressure to low pressure. Arterioles account for most of TPR. Veins provide most of the blood storage capacity. Viscosity depends mostly on hematocrit. Viscosity ↑ in hyperproteinemic states (eg, multiple myeloma), polycythemia.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "An 83-year-old woman with long-standing hypertension presents after a near-syncopal episode upon standing. Her blood pressure is taken sitting and then standing. Systolic pressure decreased slightly and pulse pressure increased in the standing position. Which of the following can lead to an increased pulse pressure?", "options": [{"label": "A", "text": "An increased heart rate", "correct": false}, {"label": "B", "text": "A decreased stroke volume", "correct": false}, {"label": "C", "text": "An increase in total peripheral resistance", "correct": false}, {"label": "D", "text": "A decrease in aortic compliance", "correct": true}], "correct_answer": "D. A decrease in aortic compliance", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>A decrease in aortic compliance A decrease in aortic compliance (that is, an increase in the stiffness of the aorta) will increase pulse pressure.</p>\n<p><strong>Highyeild:</strong></p><p>Pulse pressure is the difference between the systolic and diastolic pressure that occurs during the cardiac cycle. It is determined by the change in volume in the aorta during systole and the compliance of the aorta. A decrease in aortic compliance (that is, an increase in the stiffness of the aorta) will increase pulse pressure. When mean arterial pressure increases, the average volume of blood in the aorta is higher than normal. The increased volume decreases aortic compliance. Assuming that the stroke volume remains normal, the decreased compliance will result in increased pulse pressure. In aortic stenosis, the rate at which blood is ejected from the ventricle is decreased. The decreased ejection rate provides time for blood to flow from the aorta to the periphery during systole. Therefore, the increase in aortic volume during systole and the pulse pressure is</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest all options are incorrect because If heart rate increases, stroke volume and therefore pulse pressure will decrease. An increase in total peripheral resistance will prevent blood from flowing out of the aorta during systole and therefore decrease pulse pressure.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 47-year-old female is brought to the Emergency Department because she fainted at the gym during her daily aerobic workout. A prominent systolic murmur is heard and a presumptive diagnosis of aortic stenosis is made. Which of the following is consistent with that diagnosis?", "options": [{"label": "A", "text": "A decreased pulse pressure", "correct": true}, {"label": "B", "text": "An increased arterial pressure", "correct": false}, {"label": "C", "text": "A decreased left ventricular diastolic pressure", "correct": false}, {"label": "D", "text": "An increased ejection fraction", "correct": false}], "correct_answer": "A. A decreased pulse pressure", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>A decreased pulse pressure In aortic stenosis, there is a narrowing of the aortic valve, which interferes with the ejection of blood from the left ventricle into the aorta, which results in a decrease in stroke volume and a subsequent decrease in pulse pressure.</p>\n<p><strong>Highyeild:</strong></p><p>In aortic stenosis, the resistance of the aortic valve increases, making it more difficult for blood to be ejected from the heart. Because a pressure drop occurs across the stenotic aortic valve, the ventricular pressure is much larger than the aortic pressure. Although stroke volume typically decreases leading to a decrease in pulse pressure, a normal cardiac output and arterial pressure can still be maintained by increasing heart rate. However, the increased afterload will lead to a decreased ejection fraction and increased cardiac oxygen consumption.</p>\n<p><strong>Extraedge:</strong></p><p>Aortic Stenosis Pressure-volume loop Physiology of Aortic Stenosis:- ↑ LV pressure ↑ ESV No change in EDV (if mild) ↓ SV Ventricular hypertrophy → ventricular compliance → ↑ EDP for given EDV</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The phases of the ventricular muscle action potential are represented by the lettered points on the diagram below. At this point, the ventricular action potential is the membrane potential most dependent on calcium permeability:", "options": [{"label": "A", "text": "Point A", "correct": false}, {"label": "B", "text": "Point B", "correct": false}, {"label": "C", "text": "Point C", "correct": false}, {"label": "D", "text": "Point D", "correct": true}], "correct_answer": "D. Point D", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683532060605-QTDY009011IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Point D The plateau phase (phase 2) is the result of the influx of calcium. Although calcium channels begin to open during the upstroke (phase 0), the greatest number of calcium channels is open during the plateau. The upstroke is primarily dependent on the opening of Na+ channels. The initial repolarization (phase 1) is dependent on the inactivation of Na+ channels and the opening of a transient K+ channel. Repolarization (phase 3) is produced by the inactivation of Ca2+ channels and the activation of the delayed rectifier K+ channels .</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 2-year-old boy is mauled by a black bear while hiking with his family in the Sanchore mountains. A claw puncture wound to the skull compressed the underlying brain tissue. Which of the following occurs in response to an increased intracranial pressure?", "options": [{"label": "A", "text": "Blood pressure and heart rate increases", "correct": false}, {"label": "B", "text": "Blood pressure and heart rate decreases", "correct": false}, {"label": "C", "text": "Blood pressure increases and heart rate decreases", "correct": true}, {"label": "D", "text": "Blood pressure decreases and heart rate increases", "correct": false}], "correct_answer": "C. Blood pressure increases and heart rate decreases", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Blood pressure increases and heart rate decreases If intracranial pressure is rapidly elevated, cerebral blood flow is reduced. The increase in intracranial pressure stimulates the vasomotor center and produces an increase in systemic blood pressure that may lead to a restoration of cerebral blood flow. The increased blood pressure induces bradycardia mediated by the baroreceptor reflex.</p>\n<p><strong>Highyeild:</strong></p><p>The Cushing reflex (vasopressor response, Cushing reaction, Cushing effect, and Cushing phenomenon) is a physiological nervous system response to acute elevations of intracranial pressure (ICP), resulting in Cushing’s triad of widened pulse pressure (increasing systolic, decreasing diastolic), bradycardia, and irregular respirations.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest Options are incorrect because in the cushing reflex Blood pressure increases and heart rate decreases.</p>\n<p><strong>Extraedge:</strong></p><p>Component of Cushing reflex (the triad of hypertension, bradycardia, and respiratory depression)—↑ intracranial pressure constricts arterioles → cerebral ischemia → ↑ pCO2 and pH → central reflex sympathetic ↑ in perfusion pressure (hypertension) → ↑ stretch → peripheral reflex baroreceptor- induced bradycardia.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A patient with Type II diabetes reports for his 6-month check-up. His doctor prescribes a daily 30-minute routine of walking at a brisk pace. During aerobic exercise, blood flow remains relatively constant within which of the following?", "options": [{"label": "A", "text": "Brain", "correct": true}, {"label": "B", "text": "Heart", "correct": false}, {"label": "C", "text": "Skin", "correct": false}, {"label": "D", "text": "Skeletal muscles", "correct": false}], "correct_answer": "A. Brain", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Brain Blood flow to the brain is kept relatively constant during both rest and exercise by local autoregulatory mechanisms. During exercise, the brain needs to maintain adequate blood flow to meet its metabolic demands, as well as to coordinate the various physiological responses that occur during exercise. Therefore, the correct answer is A. Brain.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: B. Heart: Coronary blood flow increases to meet the increased metabolic needs of the heart. Blood flow to the gut, the kidneys, and the non-exercising muscles is reduced by sympathetic constriction of the arterioles leading to these organs. Option: C. Skin: Blood flow to the skin is increased to prevent overheating when body temperature increases. Option: D. Skeletal muscles: During aerobic exercise , vasodilation of blood vessels in the working muscles increases the skeletal muscle blood flow.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The spouse of a 55-year-old man calls an Ambulance because her husband complains of chest pain radiating down his left arm. He is transported to the emergency department, where an ECG and cardiac enzymes indicate a recent myocardial infarction. The man undergoes cardiac catheterization, including coronary angiography and hemodynamic recordings throughout the cardiac cycle. No valvular defects were present. During ventricular ejection, the pressure difference smallest in magnitude is between which of the following?", "options": [{"label": "A", "text": "Aorta and capillaries", "correct": false}, {"label": "B", "text": "Left atrium and left ventricle", "correct": false}, {"label": "C", "text": "Left ventricle and aorta", "correct": true}, {"label": "D", "text": "Right atrium and right ventricle", "correct": false}], "correct_answer": "C. Left ventricle and aorta", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Left ventricle and aorta The pressure gradient between regions of the cardiovascular system is directly proportional to the resistance of the intervening structures. During ventricular ejection, the aortic valves are open and do not offer any significant resistance to blood flow. Therefore, there is very little, if any, pressure difference between the left ventricle and the aorta.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A: Because most of the resistance in the systemic vasculature occurs at the level of the arterioles, there is a large pressure gradient between the aorta and the capillaries. Option: B: Because the mitral valve is closed during ventricular ejection, there is a pressure difference between the l eft ventricle and the left atrium. Option: D: Similarly, because the tricuspid valve is closed during ventricular ejection, there is an appreciable pressure difference between the right ventricle and the right atrium.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 33-year-old man was admitted to the hospital after suffering from diarrhea and vomiting due to Cholera. To compensate for the body fluids he was given intravenous fluids for three days. After the third day, he developed an elevation in his jugular venous pressure as shown in the picture. If he received 8L and his urine output is 5L in these three days. How much excess fluid did the patient receive?", "options": [{"label": "A", "text": "1L", "correct": false}, {"label": "B", "text": "1.5L", "correct": true}, {"label": "C", "text": "2L", "correct": false}, {"label": "D", "text": "2.5L", "correct": false}], "correct_answer": "B. 1.5L", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>1.5L The man is suffering from hypovolemia with intravenous fluid excess since she has received 3L more fluid than he passed out in the Considering 500ml/day insensible loss would be 1.5L in three days. So, the total excess fluid is 1.5 L Only option B is the correct value.</p>\n<p><strong>Highyeild:</strong></p><p>The waveforms seen in a normal JVP are:- a wave corresponds to atrial contraction and occurs just after the P wave (on ECG) and just before the first heart sound. c wave represents the bulging of the tricuspid valve into the right atrium during ventricular systole. x descent corresponds to the atrial relaxation during atrial diastole. v wave represents atrial filling during ventricular systole and peaks at the second heart sound. y-descent represents passive emptying of the right atrium into the right ventricle after tricuspid valve opening.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Blood flow through a vessel varies directly with?", "options": [{"label": "A", "text": "Viscosity", "correct": false}, {"label": "B", "text": "Pressure difference", "correct": true}, {"label": "C", "text": "Resistance", "correct": false}, {"label": "D", "text": "None of above", "correct": false}], "correct_answer": "B. Pressure difference", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Pressure difference This formula states that the blood flow is directly proportional to the pressure difference but inversely proportional to the resistance.</p>\n<p><strong>Highyeild:</strong></p><p>Flow in any portion of the vascular system is equal to the effective perfusion pressure in that portion divided by the resistance. The effective perfusion pressure is the mean intraluminal pressure at the arterial end minus the mean pressure at the venous end. Viscosity in anemia. Q∞r4 R∞ 1/r4 Capillaries have the highest total cross-sectional area and lowest flow velocity. Pressure gradient drives flow from high pressure to low pressure. Arterioles account for most of TPR. Veins provide most of the blood storage capacity. Viscosity depends mostly on hematocrit. Viscosity ↑ in hyperproteinemic states (eg, multiple myeloma), polycythemia.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following provides a major part of total peripheral resistance:", "options": [{"label": "A", "text": "Venules", "correct": false}, {"label": "B", "text": "Capillaries", "correct": false}, {"label": "C", "text": "Arterioles", "correct": true}, {"label": "D", "text": "Small arteries", "correct": false}], "correct_answer": "C. Arterioles", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Arterioles The small arteries and arterioles are referred to as resistance vessels because they are the principal site of peripheral resistance.</p>\n<p><strong>Highyeild:</strong></p><p>At rest, at least 50% of the circulating blood volume is in the systemic veins, 12% is in the heart cavities, and 18% is in the low-pressure pulmonary circulation. Only 2% is in the aorta, 8% in the arteries, 1% in the arterioles, and 5% in the capillaries. A large amount of blood can be added to the venous system before the veins become distended to the point where further increments in volume produce a large rise in venous pressure. The veins are therefore called capacitance vessels. When extra blood is administered by transfusion, less than 1% of it is distributed in the arterial system (the “high-pressure system”), and all the rest is found in the systemic veins, pulmonary circulation, and heart chambers other than the left ventricle (the “low-pressure system)</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Venules and capillaries have a smaller impact on total peripheral resistance, while small arteries also contribute but to a lesser extent than arterioles.</p>\n<p><strong>Extraedge:</strong></p><p>Capillaries have the highest total cross-sectional area and lowest flow velocity. Pressure gradient drives flow from high pressure to low pressure. Arterioles account for most of TPR. Veins provide most of the blood storage capacity. Viscosity depends mostly on hematocrit. Viscosity ↑ in hyperproteinemic states (eg, multiple myeloma), polycythemia. Viscosity in anemia.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Pulmonary wedge pressure corresponds to which of the following:", "options": [{"label": "A", "text": "Right ventricular pressure", "correct": false}, {"label": "B", "text": "Left ventricular pressure", "correct": false}, {"label": "C", "text": "Left atrial pressure", "correct": true}, {"label": "D", "text": "Right atrial pressure", "correct": false}], "correct_answer": "C. Left atrial pressure", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Left atrial pressure Pulmonary capillary wedge pressure (PCWP) provides an estimate of left atrial pressure (LAP).</p>\n<p><strong>Highyeild:</strong></p><p>The pressure measured through the catheter called the “wedge pressure,” is about 5 mm Hg. Because all blood flow has been stopped in the small wedged artery, and because the blood vessels extending beyond this artery make a direct connection with the pulmonary capillaries, this wedge pressure is usually only 2 to 3 mm Hg greater than the left atrial pressure. When the left atrial pressure rises to high values, the pulmonary wedge pressure also rises.</p>\n<p><strong>Extraedge:</strong></p><p>Pulmonary artery wedge pressure (PAWP) measured with a Swan-Ganz catheter is an index of the pulmonary capillary hydrostatic pressure. PAWP is also an index of the pressures downstream in the left atrium and in the left ventricle at the end of diastole; that is, PAWP is an index of left ventricular preload. Normal PAWP is ≤12 mmHg. Thus, an elevated PAWP of 25 mmHg will drive fluid movement out of the pulmonary capillaries Because of the paucity of smooth muscle in the pulmonary vasculature, pulmonary vascular resistance is distributed evenly across the arterioles, capillaries, and venules and there is a steady decline in pressures across the pulmonary circulation, with no large pressure drop across any element, such as seen in the systemic arterioles. Image added: Swan Ganz catheter</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The cerebral blood flow does not depend on?", "options": [{"label": "A", "text": "Cerebral Metabolic rate", "correct": false}, {"label": "B", "text": "CO2", "correct": false}, {"label": "C", "text": "Blood pressure", "correct": false}, {"label": "D", "text": "K+ Concentration", "correct": true}], "correct_answer": "D. K+ Concentration", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>K+ Concentration Cerebral blood flow does not depend on Potassium concentration.</p>\n<p><strong>Highyeild:</strong></p><p>Cerebral blood flow is highly related to tissue metabolism. Several metabolic factors are believed to contribute to cerebral blood flow regulation: Carbon dioxide concentration, Hydrogen ion concentration, Oxygen concentration Cerebral Blood Flow Autoregulation Protects the Brain From Fluctuations in Arterial Pressure Changes. During normal daily activities, arterial pressure can fluctuate widely, rising to high levels during states of excitement or strenuous activity and falling to low levels during sleep.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Yes, This option is correct. Cerebral blood flow is closely tied to cerebral metabolic rate . The brain requires a continuous supply of oxygen and glucose to fuel its metabolic processes, and the delivery of these substrates is closely coupled to cerebral blood flow . Option: B. Carbon dioxide (CO2) plays an important role in regulating cerebral blood flow . CO2 is a potent vasodilator, meaning that it causes blood vessels to relax and widen, which increases blood flow. Option: C. The brain has an autoregulatory mechanism that helps to maintain a relatively constant cerebral blood flow over a range of blood pressures. Within this range, changes in blood pressure do not significantly affect cerebral blood flow.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following is TRUE regarding physiological changes in the brain during exercise?", "options": [{"label": "A", "text": "Blood flow is decreased", "correct": false}, {"label": "B", "text": "Blood flow is increased", "correct": false}, {"label": "C", "text": "Blood flow remains unaltered", "correct": true}, {"label": "D", "text": "Blood flow initially is increased and then decreases", "correct": false}], "correct_answer": "C. Blood flow remains unaltered", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Blood flow remains unaltered In a normal physiological state, total blood flow to the brain is remarkably constant due in part to the prominent contribution of large arteries to vascular resistance</p>\n<p><strong>Highyeild:</strong></p><p>Transection of the sympathetic nerves or mild to moderate stimulation of them usually causes little change in cerebral blood flow because the blood flow autoregulation mechanism can override the nervous effects. When mean arterial pressure rises acutely to an exceptionally high level, such as during strenuous exercise or during other states of excessive circulatory activity, the sympathetic nervous system normally constricts the large and intermediate-sized brain arteries enough to prevent the high pressure from reaching the smaller brain blood vessels. This mechanism is important in preventing vascular hemorrhages into the brain—that is, for preventing the occurrence of “cerebral stroke.”</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "All are increased during exercise except:", "options": [{"label": "A", "text": "Cardiac output", "correct": false}, {"label": "B", "text": "Venous return", "correct": false}, {"label": "C", "text": "Coronary blood flow", "correct": false}, {"label": "D", "text": "Peripheral vascular resistance", "correct": true}], "correct_answer": "D. Peripheral vascular resistance", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Peripheral vascular resistance Mean arterial pressure is increased despite the decrease in Peripheral vascular resistance because cardiac output is increased more than vascular resistance is decreased.</p>\n<p><strong>Highyeild:</strong></p><p>The rate of blood flow through the entire circulatory system is equal to the rate of blood pumping by the heart—that is, it is equal to the cardiac output. In an adult human being, this is approximately 100 ml/sec. The pressure difference from the systemic arteries to the systemic veins is about 100 mm Hg. Therefore, the resistance of the entire systemic circulation, called the total peripheral resistance, is about 100/100, or 1 PRU. In conditions in which all the blood vessels throughout the body become strongly constricted, the total peripheral resistance occasionally rises to as high as 4 PRU. Conversely, when the vessels become greatly dilated, the resistance can fall to as little as 0.2 PRU. There is a net fall in total peripheral resistance due to vasodilation in exercising muscles.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Cardiac output refers to the amount of blood pumped by the heart per minute and is increased during exercise to deliver more oxygen and nutrients to working muscles. Option: B. Venous return refers to the volume of blood returning to the heart from the veins and is also increased during exercise to maintain adequate cardiac output. Option: C. Coronary blood flow is the blood flow to the heart muscle itself and is increased during exercise to meet the increased metabolic demand of the heart.</p>\n<p><strong>Extraedge:</strong></p><p>Local mechanisms maintaining a high blood flow in exercising muscle include a fall in tissue pO2, a rise in tissue pCO2, and accumulation of K+ and other vasodilator metabolites. The temperature rises in active muscle, and this further dilates the vessels. Dilation of the arterioles and precapillary sphincters causes a 10 to 100-fold increase in the number of open capillaries.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Most permeable capillaries are seen in?", "options": [{"label": "A", "text": "Post pituitary", "correct": false}, {"label": "B", "text": "Liver", "correct": false}, {"label": "C", "text": "Kidney", "correct": true}, {"label": "D", "text": "Small intestine", "correct": false}], "correct_answer": "C. Kidney", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Kidney The kidney has the most permeable capillaries among the options provided. This is because the kidney is responsible for the filtration of blood and the formation of urine. The glomerular capillaries are the places where the filtration part of urine production occurs. Therefore, the endothelial walls of these capillaries are fenestrated to make them more permeable than capillaries elsewhere, so more fluid is filtered at a given filtration pressure.</p>\n<p><strong>Highyeild:</strong></p><p>Special Types of “Pores” Occur in the Capillaries of Certain Organs. The “pores” in the capillaries of some organs have special characteristics to meet the peculiar needs of the organs. Some of these characteristics are as follows: In the brain, the junctions between the capillary endothelial cells are mainly “tight” junctions that allow only extremely small molecules such as water, oxygen, and carbon dioxide to pass into or out of the brain tissues. In the liver, the opposite is true. The clefts between the capillary endothelial cells are wide open so that almost all dissolved substances of the plasma, including the plasma proteins, can pass from the blood into the liver tissues. The pores of the gastrointestinal capillary membranes are midway in size between those of the muscles and those of the liver. In the glomerular capillaries of the kidney, numerous small oval windows called fenestrae to penetrate all the way through the middle of the endothelial cells so that tremendous amounts of small molecular and ionic substances (but not the large molecules of the plasma proteins) can filter through the glomeruli without having to pass through the clefts between the endothelial cells.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. The capillaries in the posterior pituitary gland are fenestrated, which means they have small pores that allow for the easy diffusion of molecules between the blood and the surrounding tissue. Option: B. The liver's capillaries, known as sinusoids, are largely permeable due to their unique structure. Option: D. Largely permeable is because the small intestine plays a crucial role in the absorption of nutrients from the digested food.</p>\n<p><strong>Extraedge:</strong></p><p>Capillaries have the highest total cross-sectional area and lowest flow velocity. Pressure gradient drives flow from high pressure to low pressure. Arterioles account for most of TPR. Veins provide most of the blood storage capacity. Viscosity depends mostly on hematocrit. Viscosity ↑ in hyperproteinemic states (eg, multiple myeloma), polycythemia. Viscosity in anemia.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "At which of the following sites in the cardiovascular system does the blood flow lose the greatest amount of energy?", "options": [{"label": "A", "text": "Mitral valve", "correct": false}, {"label": "B", "text": "Large arteries", "correct": false}, {"label": "C", "text": "Arterioles", "correct": true}, {"label": "D", "text": "Capillaries", "correct": false}], "correct_answer": "C. Arterioles", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Arterioles The energy imparted to the blood by the ventricular systole is dissipated as the blood flows through the circulation. The greatest energy loss occurs where the resistance to blood flow is greatest. This would also be the site of the greatest pressure change. The arteriolar vessels produce the largest resistance to blood, and thus the greatest energy loss and pressure drop occur as the blood passes through them.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "As the blood flows from arteries to capillaries in a systemic circulatory system, which of the following options shows the correct match?", "options": [{"label": "A", "text": "Increased total cross-sectional area, increased blood flow velocity, increased mean blood pressure", "correct": false}, {"label": "B", "text": "Increased total cross-sectional area, increased blood flow velocity, decreased mean blood pressure", "correct": false}, {"label": "C", "text": "Decreased total cross-sectional area, increased blood flow velocity, decreased mean blood pressure", "correct": false}, {"label": "D", "text": "Increased total cross-sectional area, decreased blood flow velocity, decreased mean blood pressure", "correct": true}], "correct_answer": "D. Increased total cross-sectional area, decreased blood flow velocity, decreased mean blood pressure", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Increased total cross-sectional area, decreased blood flow velocity, decreased mean blood pressure Arterioles and capillaries have more cross-sectional area than the artery due to the massive branching of arterioles and capillaries. So there will be an increased total cross-sectional area of the capillaries. We know that velocity= Q/A where A is cross-sectional area So the velocity is inversely proportional to the cross-sectional That means velocity of blood flow will decrease as blood moves from arteries to capillaries. Mean blood pressure decreases in arterioles and capillaries due to increased cross-sectional area of these. So the correct answer is D The rest of the other options are false.s</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 34 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A 44-year-old woman presents to her gynecologist with complaints of not having a period for the last 8 months. She reports a negative pregnancy test at home. Upon further questioning, she reports a daily headache, changes in vision, and a milky discharge from the breast. She has no medical problems and is not taking any medications. On physical examination, she is noted to have galactorrhea and diminished peripheral vision bilaterally. The remainder of her examination is normal. A pregnancy test is repeated and is negative. A thyroid-stimulating hormone (TSH) level is drawn and is normal. Her serum prolactin level is elevated significantly. What is the most probable diagnosis of this case?", "options": [{"label": "A", "text": "Hypopituitarism", "correct": false}, {"label": "B", "text": "Cushing disease", "correct": false}, {"label": "C", "text": "Pituitary adenoma", "correct": true}, {"label": "D", "text": "Pituitary dwarfism", "correct": false}], "correct_answer": "C. Pituitary adenoma", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Pituitary adenoma She is found to have a prolactin-secreting pituitary adenoma.</p>\n<p><strong>Highyeild:</strong></p><p>Elevated prolactin and amenorrhea: Elevated prolactin levels inhibit pulsatile gonadotropin-releasing hormone (GnRH) secretion. Thyroid disease and elevated prolactin: Hypothyroidism is associated with an elevated thyrotropin-releasing hormone (TRH) level that increases the secretion of prolactin. Synthesis of the posterior pituitary hormones: Hypothalamic nuclei-hormones are synthesized in nerve cell bodies, packaged in secretory granules, and transported down the nerve axon to the posterior pituitary.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest all options are incorrect because these cause low prolactin not High .</p>\n<p><strong>Extraedge:</strong></p><p>The regulation of prolactin secretion differs from that of the other pituitary hormones in that PRL secretion is under tonic inhibition from the hypothalamus. If the hypothalamohypophysial portal system is disrupted, PRL secretion increases rather than decreases as is the case for the other pituitary hormones. Most evidence points to dopamine rather than a peptide as being the prolactin inhibitory hormone. In addition to this inhibitory pathway, PRL secretion can be stimulated by TRH. The main target of PRL is the mammary gland, which promotes the secretion of colostrum and milk. PRL levels rise during pregnancy. After parturition, basal levels fall, but there are spikes in PRL levels during and after periods of nursing. in The spikes in PRL secretion are because of neural signals from the breast acting at the level of the hypothalamus to decrease dopamine release into the hypothalamo-hypophyseal portal system. This reflex and the high levels of PRL suppress the hypothalamic secretion of GnRH, thus inhibiting the menstrual cycle.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The secretion of prolactin is controlled by:", "options": [{"label": "A", "text": "Serotonin", "correct": false}, {"label": "B", "text": "GABA", "correct": false}, {"label": "C", "text": "Somatostatin", "correct": false}, {"label": "D", "text": "Dopamine", "correct": true}], "correct_answer": "D. Dopamine", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Dopamine One of the main regulators of the production of prolactin from the pituitary gland is the hormone called dopamine, which is produced by the hypothalamus, the part of the brain directly above the pituitary gland. Dopamine restrains prolactin production , so the more dopamine there is, the less prolactin is released.</p>\n<p><strong>Highyeild:</strong></p><p>It is believed that anterior pituitary secretion of prolactin is controlled either entirely or almost entirely by an inhibitory factor formed in the hypothalamus and transported through the hypothalamic hypophyseal portal system to the anterior pituitary gland. This factor is sometimes called prolactin inhibitory hormone, but it is almost certainly the same as the catecholamine dopamine, which is known to be secreted by the arcuate nuclei of the hypothalamus and can decrease prolactin secretion as much as 10-fold. This can be accounted by the fact that dopamine antagonists increase milk production leading to galactorrhea as a side effect and dopamine agonists are used to arrest milk secretion following an IUD or stillbirth.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Serotonin is a neurotransmitter that mediates satisfaction, happiness, and optimism. Option B. GABA is known for producing a calming effect. It's thought to play a major role in controlling nerve cell hyperactivity associated with anxiety, stress, and fear. Option C. Somatostatin produces predominantly neuroendocrine inhibitory effects across multiple systems. It is known to inhibit GI, endocrine, exocrine, pancreatic, and pituitary secretions.</p>\n<p><strong>Extraedge:</strong></p><p>Dopamine Dobutamine Source Natural catecholamine (Precursor of NE & also release NE from cardiac nerve terminals Synthetic catecholamine (Does not release NE) Mechanism Adrenergic + Dopaminergic DA 2, α , β Pure adrenergic β1 > β2> α Effect on BP Increase, sustained Increase / neutral / decrease Effect on PCWP No favorable effect Reduce / optimise / favorable Effect on renal blood flow and diuresis Improves at low dose by direct action No direct action / May improve due to improved cardiac function Arrhythmogenicity More (Less than dobutamine More, (Generally safe) Inotropic action Less More, Consistent Clinical utility* Shock Cardiac failure Ischemic LVF Renal failure ● Yes ● No ● No ● Yes ● No ● Yes ● Yes ● No</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Prolactin level is highest during:", "options": [{"label": "A", "text": "24 hours after ovulation", "correct": false}, {"label": "B", "text": "24 hours after delivery", "correct": true}, {"label": "C", "text": "REM Sleep", "correct": false}, {"label": "D", "text": "After running for an hour", "correct": false}], "correct_answer": "B. 24 hours after delivery", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>24 hours after delivery The maximum level of prolactin is seen during pregnancy and in the immediate postpartum period. During pregnancy, the secretion is increased reaching a peak at the time of delivery . After delivery, the plasma concentration falls to nonpregnant levels in a few weeks. Suckling produces surges of prolactin release.</p>\n<p><strong>Highyeild:</strong></p><p>Factors affecting PRL secretion Factors increasing PRL secretion Factors inhibiting PRL secretion ● Estrogen (during pregnancy stimulates lactotropes to secrete PRL) ● Dopamine ● Breast feeding (reflex increase) ● Bromocryptine, metoclopramid (Dopamine agonist) ● TRH ● Somatostatin ● Stress ● PRL (by negative feedback) ● sleep ● Dopamine antagonists ● chest wall stimulation or trauma</p>\n<p><strong>Extraedge:</strong></p><p>Prolactin (PRL) is a single chain polypeptide with 198 amino acids, secreted by the anterior pituitary. Structurally similar to GH, its receptors resemble GH receptors, Prolactin also binds to specific receptors in the gonads, lymphoid cells, and liver Pulsatile, circadian fashion Normally Highest - sleep Nadir (lowest) - 10 am to noon Reference Range Serum PRL 1-25 ng/mL or ug/L for females 1-20 ng/mL or ug/L for males Those that are caused by increased prolactin levels are: Amenorrhea (disappearance of ovulation periods) Galactorrhea (Milk production; infrequent in men) Loss of axillary and pubic hair Hypogonadism (Reduced function of the gonads.) Gynecomastia (an increase in male breast size) Erectile dysfunction (in males) Those that are caused by mass effect are: Headaches Vision Changes-visual field deficits, blurred vision, decreased visual acuity Cranial nerve palsies-especially with invasive tumors or with pituitary apoplexy Seizures, Hydrocephalus, Unilateral exophthalmos are rare presentations Hypopituitarism Pituitary apoplexy is a medical emergency because of spontaneous hemorrhage into the pituitary tumor and presents with severe headaches, vision changes, and acute panhypopituitarism.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 13 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A newborn baby is cyanotic upon delivery. The cyanosis is not relieved by breathing 100% oxygen. A diagnosis of persistent fetal circulation is made based on which of the following clinical signs?", "options": [{"label": "A", "text": "Mitral regurgitation", "correct": false}, {"label": "B", "text": "Left ventricular hypertrophy", "correct": false}, {"label": "C", "text": "Pulmonary vasoconstriction and hypertension", "correct": true}, {"label": "D", "text": "Systemic hypertension", "correct": false}], "correct_answer": "C. Pulmonary vasoconstriction and hypertension", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Pulmonary vasoconstriction and hypertension Persistent fetal circulation (PFC) is a condition where the circulatory system of the newborn baby fails to adapt to the changes that occur after birth. It is characterized by persistent fetal shunts (ductus arteriosus and foramen ovale) and increased pulmonary vascular resistance, which can lead to cyanosis and hypoxemia.</p>\n<p><strong>Highyeild:</strong></p><p>In PFC, the pulmonary vessels remain constricted, and blood flow is shunted away from the lungs, leading to persistent hypoxemia and cyanosis. Breathing 100% oxygen does not relieve the cyanosis because the problem is not due to a lack of oxygen supply but rather the inability of the blood to pick up oxygen from the lungs due to the persistent pulmonary vasoconstriction.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Mitral regurgitation and l eft ventricular hypertrophy are signs of left-sided heart failure , which is not typically seen in PFC. Systemic hypertension is also not a typical sign of PFC and is more commonly associated with other cardiovascular conditions.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 22-year-old woman is hospitalized with a history of respiratory distress, fever, and fatigue. ST segment and T wave abnormalities suggest myocarditis, which is attributed to an acute viral origin. Over the next several days, significant peripheral edema develops. The edema is most likely caused by which of the following?", "options": [{"label": "A", "text": "Decreased capillary permeability", "correct": false}, {"label": "B", "text": "Decreased arterial pressure", "correct": false}, {"label": "C", "text": "Increased plasma protein concentration", "correct": false}, {"label": "D", "text": "Increased central venous pressure", "correct": true}], "correct_answer": "D. Increased central venous pressure", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Increased central venous pressure The development of peripheral edema in a patient with myocarditis suggests the presence of heart failure. In this case, the most likely cause of the edema is increased central venous pressure, which is a hallmark feature of right-sided heart failure.</p>\n<p><strong>Highyeild:</strong></p><p>Myocarditis is an inflammation of the heart muscle that can lead to impaired heart function and heart failure. Acute viral infections are a common cause of myocarditis in young adults. The inflammation can cause damage to the myocardium and impair the ability of the heart to pump blood effectively.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Decreased capillary permeability and arterial pressure are not typical causes of peripheral edema . Increased plasma protein concentration can contribute to edema formation, but it is not the primary cause of the edema in this case.</p>\n<p><strong>Extraedge:</strong></p><p>table,tr,th,td {border:1px solid black;} Clinical feature Diagnosis Treatment • Dyspnoea with pulmonary crepitations • Tachycardia • Hepatomegaly • Ascites • Peripheral Oedema • Venous congestion and dilatation of face and neck; associated signs • Heart failure • Cardiac tamponade • Tension pneumothorax • Diuretics, may require inotropes • Treat underlying cause CVP reading is Low? Clinical feature Diagnosis Treatment • Tachycardia • Low normal hypotension •U.O.P. oligo or www anuria · Hypovolaemia · Fluid challenge until CVP within normal limits and treat underlying Cause</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A sedentary individual goes to her physician’s office for a cardiopulmonary exercise stress test evaluation before starting a weight-loss exercise regimen. Physiological changes that occur during deep inspirations as lung volume approaches total lung capacity include which of the following?", "options": [{"label": "A", "text": "Elastic recoil of the lungs decreases", "correct": false}, {"label": "B", "text": "Lung compliance increases ospheric", "correct": false}, {"label": "C", "text": "Intrapleural pressure becomes less sub-atmospheric", "correct": false}, {"label": "D", "text": "Pulmonary vascular resistance increases", "correct": true}], "correct_answer": "D. Pulmonary vascular resistance increases", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Pulmonary vascular resistance increases In this case, Pulmonary vascular resistance will be increased. The increased pulmonary vascular resistance seen at total lung capacity (TLC) is due to an increase in the resistance of the alveolar vessels (pulmonary capillaries) caused by compression by the high alveolar volume. The increased pulmonary vascular resistance seen at residual volume is due to an increase in the resistance of the extra-alveolar vessels caused by compression by the positive intrapleural pressure generated during forced expiration.</p>\n<p><strong>Highyeild:</strong></p><p>Pulmonary vascular resistance (PVR) varies with lung volume. PVR is lowest at functional residual capacity and increases at both high and low lung volumes. As lung volume increases toward TLC, the compliance of the lungs (slope of the pressure-volume curve) decreases and elastic recoil of the lung increases, that is, the lungs resist further expansion. Intrapleural pressure becomes more sub-atmospheric during inspiration, approaching –30 cm H2O at TLC; as a result, the transmural pressure across the intrathoracic airways (Pin-Pout) increases, which increases airway radius, and decreases airway resistance according to Poiseuille’s law.</p>\n<p><strong>Extraedge:</strong></p><p>The amount of air that moves into the lungs with each inspiration (or the amount that moves out with each expiration) during quiet breathing is called the tidal volume (TV). Typical values for TV are on the order of 500–750 mL. The air inspired with a maximal inspiratory effort in excess of the TV is the inspiratory reserve volume (IRV; ∼2 L). The volume expelled by an active expiratory effort after passive expiration is the expiratory reserve volume (ERV; ∼1 L), and the air left in the lungs after a maximal expiratory effort is the residual volume (RV; ∼1.3 L). When all four of the above components are taken together, they make up the total lung capacity (TLC, ∼5 L). The TLC can be broken down into alternative capacities that help define functioning lungs. The vital capacity (VC, ∼3.5 L) refers to the maximum amount of air expired from the fully inflated lungs, or maximum inspiratory level (this represents TV + IRV + ERV). The inspiratory capacity (IC, ∼2.5 L) is the maximum amount of air inspired from the end-expiratory level (IRV + TV). The functional residual capacity (FRC; ∼2.5 L) represents the volume of the air remaining in the lungs after the expiration of a normal breath (RV + ERV).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 65-year-old man with congestive heart failure (CHF) develops increasing shortness of breath in the recumbent position. A chest X-ray reveals cardiomegaly, horizontal lines perpendicular to the lateral lung surface indicative of increased opacity in the pulmonary septa, and lung consolidation. Pulmonary edema in CHF is promoted by which of the following?", "options": [{"label": "A", "text": "Decreased pulmonary capillary permeability", "correct": false}, {"label": "B", "text": "Decreased pulmonary interstitial oncotic pressure", "correct": false}, {"label": "C", "text": "Increased pulmonary capillary hydrostatic pressure", "correct": true}, {"label": "D", "text": "Increased pulmonary capillary oncotic pressure", "correct": false}], "correct_answer": "C. Increased pulmonary capillary hydrostatic pressure", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Increased pulmonary capillary hydrostatic pressure In CHF, left ventricular dysfunction increases left ventricular end-diastolic pressure, which raises LAP, pulmonary venous pressure, and pulmonary capillary pressure, which is the hydrostatic pressure tending to drive fluid movement out of the pulmonary capillaries, due to the imbalance in Starling forces. Thus, pulmonary edema, generally limited to the interstitium of the lungs, is a hallmark of CHF.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option. A, B, and D: All of the other responses would act to decrease fluid movement out of the capillary.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A Swan-Ganz catheter is placed in a post-myocardial infarction (MI) patient in the Medical Intensive Care Unit. The patient is found to have a pulmonary artery wedge pressure of 25 mmHg. It is indicative of which of the following?", "options": [{"label": "A", "text": "Decreased pulmonary capillary hydrostatic pressure", "correct": false}, {"label": "B", "text": "Decreased left atrial pressure", "correct": false}, {"label": "C", "text": "Decreased left ventricular end-diastolic pressure", "correct": false}, {"label": "D", "text": "Increased net fluid movement out of the pulmonary capillaries", "correct": true}], "correct_answer": "D. Increased net fluid movement out of the pulmonary capillaries", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683534611303-QTDY056005IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Increased net fluid movement out of the pulmonary capillaries Pulmonary artery wedge pressure (PAWP) measured with a Swan-Ganz catheter is an index of the pulmonary capillary hydrostatic pressure.</p>\n<p><strong>Highyeild:</strong></p><p>The Swan-Ganz catheter measures the pressure in the pulmonary artery and its branches. The PAWP reflects the pressure in the left atrium, which in turn reflects the pressure in the left ventricle at the end of the diastole. An increased PAWP indicates an elevated left ventricular end-diastolic pressure, which can occur in conditions such as left ventricular failure or mitral stenosis.</p>\n<p><strong>Extraedge:</strong></p><p>PAWP is also an index of the pressures downstream in the left atrium and the left ventricle at the end of diastole; that is, PAWP is an index of left ventricular preload. Normal PAWP is ≤12 mmHg. Thus, an elevated PAWP of 25 mmHg will drive fluid movement out of the pulmonary capillaries. Because of the paucity of smooth muscle in the pulmonary vasculature, pulmonary vascular resistance is distributed evenly across the arterioles, capillaries, and venules and there is a steady decline in pressures across the pulmonary circulation, with no large pressure drop across any element, such as seen in the systemic arterioles.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 29-year-old woman is admitted to the hospital because of increasing dyspnea and swelling of both feet. An examination of her chest shows a severe pectus excavatum with only 2 cm of space between the vertebral bodies and the sternum. Pulmonary function tests show FVC and FEV1/FVC values that were 15 and 100%, respectively, of predicted. Which of the following laboratory measurements will most likely be below normal in this patient?", "options": [{"label": "A", "text": "Elastic recoil of the chest wall", "correct": false}, {"label": "B", "text": "Arterial PCO2", "correct": false}, {"label": "C", "text": "Hemoglobin concentration", "correct": false}, {"label": "D", "text": "Arterial pH", "correct": true}], "correct_answer": "D. Arterial pH", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Arterial pH Given the clinical presentation, the most likely laboratory measurement that will be below normal in this patient is arterial PCO2.</p>\n<p><strong>Highyeild:</strong></p><p>Based on the information provided, the patient has severe pectus excavatum, which is a congenital chest wall deformity that can result in compression of the lungs and impaired pulmonary function. The patient's pulmonary function tests show a decreased FVC and a normal FEV1/FVC ratio. This suggests a restrictive lung disease pattern, which is consistent with pectus excavatum.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A: (elastic recoil of the chest wall) is unlikely to be below normal because pectus excavatum is a deformity of the chest wall, not the lungs themselves. Option C: (hemoglobin concentration) is also unlikely to be below normal based on the information provided in the question stem.</p>\n<p><strong>Extraedge:</strong></p><p>The low FVC (forced vital capacity) with a normal FEV1/FVC ratio is indicative of a severe restrictive impairment, consistent with the presentation of pectus excavatum, an abnormal formation of the rib cage where the breastbone caves in, resulting in a sunken chest appearance. As a result, hypoventilation (increased PaCO2) and respiratory acidosis (decreased pH) would ensue. To compensate for the respiratory acidosis, arterial bicarbonate concentration would increase The decreased chest wall compliance in the pectus excavatum would increase the elastic recoil of the chest wall.</p>\n<p><strong>Table:</strong></p><p>Tidal\n volume Air that\n moves into lung with each quiet inspiration, 6-8 mL/kg, typically ~500 mL. Inspiratory\n reserve volume Air that\n can still be breathed in after normal inspiration Expiratory\n reserve volume Air that\n can still be breathed out after normal expiration Residual\n volume Air in\n lung after maximal expiration; RV and any lung capacity that includes RV\n cannot be measured by spirometry Inspiratory\n capacity IRV + VT Air that\n can be breathed in after normal exhalation Functional\n residual capacity RV + ERV Volume of\n gas in lungs after normal expiration; outward pulling force of chest wall is\n balanced with inward collapsing force of lungs Vital\n capacity IRV +\n VT+ERV Maximum\n volume of gas that can be expired after a maximal inspiration Total\n lung capacity IRV+VT+ERV\n + RV VC + RV = Volume of\n gas present in lungs after a maximal inspiration</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 46-year-old male came to the emergency room of the hospital with a complaint of difficulty in breathing for the last few days. Considering the pandemic situation his RT-PCR for covid 19 was negative. He was examined by the physician, and it was seen that the patient had a pitting type of edema over the legs. His ECG was done and it was noted that the R wave is tall in leads V1 and V2. Diagnosis of right heart failure was made in this patient. Which of the following changes can be seen in the hemodynamics of pulmonary capillaries?", "options": [{"label": "A", "text": "Increased pulmonary capillary hydrostatic pressure", "correct": false}, {"label": "B", "text": "Decreased pulmonary capillary hydrostatic pressure", "correct": true}, {"label": "C", "text": "Increased pulmonary capillary colloid osmotic pressure", "correct": false}, {"label": "D", "text": "Decreased pulmonary capillary colloid osmotic pressure", "correct": false}], "correct_answer": "B. Decreased pulmonary capillary hydrostatic pressure", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Decreased pulmonary capillary hydrostatic pressure Tall R wave in leads V1 and V2 indicates Right ventricular hypertrophy . It occurred secondary the chronic right heart failure. This is further proved by the pitting edema over the legs. As the patient is suffering from right heart failure, blood flow to the pulmonary capillaries will be less. As we know that capillary hydrostatic pressure is determined by the amount of blood in the capillaries. So the volume of blood will be decreased in right heart failure, thereby reducing the pulmonary capillary hydrostatic pressure. So the correct answer is B</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Colloid osmotic pressure depends on the amount of protein in the plasma . As the plasma proteins are unaffected in this patient, there will not be any effect on the colloid osmotic pressure of capillaries. So options C and D are false.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Pulmonary circulation differs from systemic circulation as?", "options": [{"label": "A", "text": "Pulmonary vasodilation in hypoxia", "correct": false}, {"label": "B", "text": "Pulmonary vasoconstriction in hypoxia", "correct": true}, {"label": "C", "text": "Decreased blood volume during systole", "correct": false}, {"label": "D", "text": "Increased basal vasoconstrictor tone", "correct": false}], "correct_answer": "B. Pulmonary vasoconstriction in hypoxia", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Pulmonary vasoconstriction in hypoxia Pulmonary vasoconstriction in hypoxia is a key difference between pulmonary circulation and systemic circulation.</p>\n<p><strong>Highyeild:</strong></p><p>In the systemic circulation, hypoxia leads to vasodilation to increase blood flow to oxygen-starved tissues, whereas, in pulmonary circulation, hypoxia causes vasoconstriction in order to redirect blood flow to better-ventilated areas of the lung. This is known as hypoxic pulmonary vasoconstriction (HPV) and helps to optimize gas exchange in the lung.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Pulmonary vasodilation in hypoxia is not a characteristic difference between pulmonary circulation and systemic circulation. Rather, it is the opposite response that is characteristic of the systemic circulation. Option C. Decreased blood volume during systole is not a difference between pulmonary and systemic circulation. Systole refers to the contraction phase of the cardiac cycle, during which blood is ejected from the ventricles into the arteries. This occurs in both the pulmonary and systemic circulations, and blood volume would be expected to decrease during systole in both. Option D. Increased basal vasoconstrictor tone is not a characteristic difference between pulmonary and systemic circulation. Basal vasoconstrictor tone is the baseline level of constriction in blood vessels, which is regulated by various factors such as sympathetic nerve activity and local metabolic factors. Both the pulmonary and systemic circulations have basal vasoconstrictor tone that is regulated in similar ways.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 18 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A patient with severe kyphoscoliosis presents with increasing dyspnea consistent with a decrease in chest wall compliance. With the contraction of the external intercostal muscles during inspiration, the Golgi tendon organ (GTO) provides the central nervous system with information about which of the following?", "options": [{"label": "A", "text": "The length of the muscle being moved", "correct": false}, {"label": "B", "text": "The velocity of muscle movement", "correct": false}, {"label": "C", "text": "The blood flow to the muscle being moved", "correct": false}, {"label": "D", "text": "The tension developed by the muscle being moved", "correct": true}], "correct_answer": "D. The tension developed by the muscle being moved", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The tension developed by the muscle being moved The Golgi tendon organ (GTO) is a sensory receptor located at the junction between skeletal muscle and tendon that responds to changes in muscle tension or force. When the external intercostal muscles contract during inspiration, the GTO provides information to the central nervous system about the tension or force being developed by the muscle. This information helps to regulate and coordinate the movement of the chest wall during breathing.</p>\n<p><strong>Highyeild:</strong></p><p>The Golgi tendon organ is a proprioceptive sensory receptor organ that senses changes in muscle. It provides the sensory component of the Golgi tendon reflex. The GTO is located in the tendon of skeletal muscles and therefore is in series with the muscle. Each time the muscle contracts, the GTO is stretched in proportion to the tension developed by the muscle. The IB afferent fibers (which innervate the GTO) produce a train of action potentials with a frequency that is in proportion to the deformation of the GTO. The muscle length and speed of shortening are sent to the CNS by IA afferents that innervate the intrafusal fibers within muscle spindles.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. The length of the muscle being moved is not directly sensed by the Golgi tendon organ . Instead, muscle spindles located within the muscle fibers themselves are responsible for sensing muscle length and providing feedback to the nervous system. Option B. The velocity of muscle movement is also not directly sensed by the Golgi tendon organ. However, changes in muscle tension or force can indirectly provide information about the velocity of muscle movement. Option C. The blood flow to the muscle being moved is not directly sensed by the Golgi tendon organ. Instead, other sensory receptors such as muscle spindles and joint receptors are responsible for providing feedback about blood flow and other metabolic factors in the muscle.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 68-year-old patient with shortness of breath is referred for pulmonary function testing, including lung volumes, flow-volume curves, and lung compliance. Which one of the following statements best characterizes pulmonary compliance?", "options": [{"label": "A", "text": "It is equivalent to ∆P/∆V", "correct": false}, {"label": "B", "text": "It is inversely related to the elastic recoil properties of the lung", "correct": true}, {"label": "C", "text": "It decreases with advancing age", "correct": false}, {"label": "D", "text": "It increases when there is a deficiency of surfactant", "correct": false}], "correct_answer": "B. It is inversely related to the elastic recoil properties of the lung", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>It is inversely related to the elastic recoil properties of the lung Lung compliance is an index of lung distensibility or the ease with which the lungs are expanded; thus, compliance is the inverse of elastic recoil.</p>\n<p><strong>Highyeild:</strong></p><p>Pulmonary compliance is inversely related to the elastic recoil properties of the lung. Elastic recoil refers to the tendency of the lung to return to its original shape after being stretched or expanded. When the lung is more elastic, it requires a higher pressure to produce a given volume change, which means that compliance is lower.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Pulmonary compliance is equivalent to the change in lung volume (∆V) divided by the change in pressure (∆P) required to produce that volume change. In other words, compliance represents the distensibility of the lung, or how easily the lung can expand when pressure is applied . The formula for compliance is C = ∆V/∆P. Option C. Pulmonary compliance generally decreases with advancing age due several factors, including changes in the elasticity of lung tissue, changes in the chest wall, and the development of lung diseases such as emphysema. Option D. Pulmonary compliance decreases when there is a deficiency of surfactant, which is a substance produced by the lungs that helps to reduce surface tension and prevent the collapse of small airways and alveoli during expiration. Without surfactant, the lungs become stiffer and less compliant, making it more difficult to breathe.</p>\n<p><strong>Table:</strong></p><p>Lung and\n chest wall Because\n of historical reasons and small pressures, pulmonary pressures are always\n presented in cm H₂O. Elastic\n recoil Tendency\n for lungs to collapse inward and chest wall to spring outward. At FRC,\n airway and alveolar pressures equal atmospheric pressure (PB; called zero),\n and intrapleural pressure is negative (preventing atelectasis). The inward\n pull of the lung is balanced by the outward pull of the chest wall. System\n pressure is atmospheric. Pulmonary vascular resistance (PVR) is at a minimum Compliance Change in\n lung volume for a change in pressure (AV/AP). Inversely proportional to wall\n stiffness and increased by surfactant. ↑\n compliance = lung easier to fill (eg, emphysema, older adults) +\n compliance = lung more difficult to fill (eg, pulmonary fibrosis, pneumonia,\n ARDS, pulmonary edema) Hysteresis Lung\n inflation follows a different pressure- volume curve than lung deflation due\n to need to overcome surface tension forces in inflation.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 48-year-old coal miner complains of shortness of breath and a productive cough. The history reveals that he has smoked 1 to 2 packs of cigarettes per day since he was 16-year-old. Pulmonary function studies are ordered including an esophageal balloon study to measure intrapleural pressures. Normally, intrapleural pressure is negative throughout a tidal inspiration and expiration because of which of the following?", "options": [{"label": "A", "text": "The lungs have the tendency to recoil outward throughout a tidal breath", "correct": false}, {"label": "B", "text": "The chest wall has the tendency to recoil inward throughout a tidal breath", "correct": false}, {"label": "C", "text": "The intact pleura causes the lungs and chest wall to recoil away from each other throughout a tidal breath", "correct": true}, {"label": "D", "text": "The intact pleura causes the lungs and chest wall to recoil in the same direction throughout a tidal breath", "correct": false}], "correct_answer": "C. The intact pleura causes the lungs and chest wall to recoil away from each other throughout a tidal breath", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The intact pleura causes the lungs and chest wall to recoil away from each other throughout a tidal breath During normal breathing, the lungs have the tendency to recoil inward, while the chest wall has the tendency to recoil outward. The space between the lungs and the chest wall is filled with pleural fluid, which creates a negative pressure in the intrapleural space. This negative pressure keeps the lungs inflated and causes the lungs and chest wall to move away from each other throughout a tidal breath.</p>\n<p><strong>Highyeild:</strong></p><p>When the pleura, and the lung-chest wall system, are intact, the inward elastic recoil of the lung opposing the outward elastic recoil of the chest wall results in a sub-atmospheric (negative) pressure with the pleural space.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. The lungs have the tendency to recoil inward during a tidal breath, not outward. This inward recoil creates a negative pressure within the alveoli, which allows air to be drawn into the lungs during inspiration. Option D. The intact pleura does cause the lungs and chest wall to move in the same direction during a tidal breath, but this is not the primary reason for the negative intrapleural pressure.</p>\n<p><strong>Table:</strong></p><p>Lung and\n chest wall Because\n of historical reasons and small pressures, pulmonary pressures are always\n presented in cm H₂O. Elastic\n recoil Tendency\n for lungs to collapse inward and chest wall to spring outward. At FRC,\n airway and alveolar pressures equal atmospheric pressure (PB; called zero),\n and intrapleural pressure is negative (preventing atelectasis). The inward\n pull of the lung is balanced by the outward pull of the chest wall. System\n pressure is atmospheric. Pulmonary vascular resistance (PVR) is at a minimum Compliance Change in\n lung volume for a change in pressure (AV/AP). Inversely proportional to wall\n stiffness and increased by surfactant. ↑\n compliance = lung easier to fill (eg, emphysema, older adults) +\n compliance = lung more difficult to fill (eg, pulmonary fibrosis, pneumonia,\n ARDS, pulmonary edema) Hysteresis Lung\n inflation follows a different pressure- volume curve than lung deflation due\n to need to overcome surface tension forces in inflation.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Surfactant is made up of which of the following:", "options": [{"label": "A", "text": "Degradable products", "correct": false}, {"label": "B", "text": "Mucoprotein", "correct": false}, {"label": "C", "text": "Fibrinogen", "correct": false}, {"label": "D", "text": "Phospholipid", "correct": true}], "correct_answer": "D. Phospholipid", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Phospholipid Surfactant is primarily composed of phospholipids, which are a type of lipid molecule that contains a hydrophilic (water-loving) head and a hydrophobic (water-fearing) tail.</p>\n<p><strong>Highyeild:</strong></p><p>The phospholipids in surfactant help to reduce surface tension within the alveoli, preventing their collapse and allowing for efficient gas exchange in the lungs.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Surfactants may contain some degradable products, but these are not the primary constituents of Option B. Mucoprotein is not a major component of surfactant. Option C. Fibrinogen is a blood protein involved in clotting and is not a component of surfactant.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A patient with right lower lobar pneumonia exhibits increasing respiratory distress. The patient is intubated, placed on a mechanical ventilator, and positioned on his left side. The dependent lung is lower?", "options": [{"label": "A", "text": "Rate of alveolar ventilation per unit volume", "correct": false}, {"label": "B", "text": "Pulmonary blood flow", "correct": false}, {"label": "C", "text": "V/Q ratio", "correct": true}, {"label": "D", "text": "PaCO2", "correct": false}], "correct_answer": "C. V/Q ratio", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>V/Q ratio The dependent lung, which is the lung that is closer to the ground when the patient is positioned on his left side, is subject to a higher hydrostatic pressure and has a lower ventilation-perfusion (V/Q) ratio compared to the non-dependent lung.</p>\n<p><strong>Highyeild:</strong></p><p>This is because the weight of the dependent lung compresses the alveoli and blood vessels, decreasing ventilation and blood flow to that area. As a result, the dependent lung has less oxygenation and more carbon dioxide retention, leading to a higher PaCO2.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. The rate of alveolar ventilation per unit volume may decrease in the dependent lung due to decreased ventilation, but this would lead to an increase in PaCO2, not a decrease. Option B. Pulmonary blood flow may decrease in the dependent lung due to compression of the blood vessels, but this would not necessarily affect the patient's respiratory distress or PaCO2. Option D. PaCO2 would be expected to increase in the dependent lung due to decreased ventilation and increased carbon dioxide retention, not decrease.</p>\n<p><strong>Extraedge:</strong></p><p>In patients with unilateral pneumonia, simply positioning the unaffected lung downward may result in improved ventilation-perfusion matching and an increase in PaO2 of 10–15 mmHg.</p>\n<p><strong>Table:</strong></p><p>Ventilation/perfusion\n mismatch Ideally,\n ventilation (V) is matched to perfusion (Q) per minute (ie, dot V / dot\n Oratio = 1 ) for adequate gas exchange. Lung\n zones: VIO at\n apex of lung = 3 (wasted ventilation) VIO at\n base of lung = 0.6 (wasted perfusion) Both ventilation and perfusion are\n greater at the base of the lung than at the apex of the lung. With exercise\n (t cardiac output), there is vasodilation of apical capillaries dot V / O\n ratio approaches 1. Certain\n organisms that thrive in high O_{2} (eg, TB) flourish in the apex. dot V /\n dot Q =0=^ `` oirway \" obstruction (shunt). In shunt, 100% O_{2} does\n not improve Pao, (eg, foreign body aspiration). dot V /\n dot O = ∞ = blood flow obstruction (physiologic dead space). Assuming <\n 100% dead space, 100% O_{2} improves Pao, (eg, pulmonary embolus).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A subject training for a triathlon reaches a workload while running that exceeds his anaerobic threshold. As a result, which of the following is increased?", "options": [{"label": "A", "text": "Venous pH", "correct": false}, {"label": "B", "text": "Arterial pH", "correct": false}, {"label": "C", "text": "[HCO3–]", "correct": false}, {"label": "D", "text": "Alveolar ventilation", "correct": true}], "correct_answer": "D. Alveolar ventilation", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/QTDY057006IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Alveolar ventilation During exercise, minute ventilation and alveolar ventilation increase linearly with carbon dioxide production up to a level of about 60% of the maximal workload.</p>\n<p><strong>Highyeild:</strong></p><p>Alveolar ventilation is an important factor in regulating the levels of carbon dioxide and oxygen in the body. The amount of carbon dioxide removed from the body is proportional to alveolar ventilation, and the amount of oxygen added to the body is dependent on the alveolar ventilation and the concentration of oxygen in the inspired air.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. Arterial pH would decrease (acidosis) due to the increased PaCO2. Option C. [HCO3–] would also decrease due to the acidosis, but it would not directly increase in response to exceeding the anaerobic threshold.</p>\n<p><strong>Extraedge:</strong></p><p>Minute ventilation Abbreviated as VE. Total volume of gas entering lungs per minute. VE = VTX RR Normal values: = RR= 12-20 breaths/min = V T =500 mL/breath Alveolar ventilation Abbreviated as VA. Volume of gas that reaches alveoli each minute V A = (V T - V D ) x RR V D = 150 mL/breath</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A candidate for cardiac transplantation undergoes cardiac catheterization. Hemodynamic findings include: Pulmonary Artery Pressure = 35 mmHg, Cardiac Output = 4 L/min, Left Atrial Pressure = 15 mmHg. Which of the following is his pulmonary vascular resistance?", "options": [{"label": "A", "text": "0.11 L/min/mmHg", "correct": false}, {"label": "B", "text": "0.2 L/min/mmHg", "correct": false}, {"label": "C", "text": "5 mmHg/L/min", "correct": true}, {"label": "D", "text": "8.75 mmHg/L/min", "correct": false}], "correct_answer": "C. 5 mmHg/L/min", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>5 mmHg/L/min Pulmonary vascular resistance (PVR) can be calculated using the following formula: PVR = (PAP - LAP) / CO where PAP is the pulmonary artery pressure, LAP is the left atrial pressure, and CO is the cardiac output. Substituting the given values, we get: PVR = (35 - 15) / 4 PVR = 20 / 4 PVR = 5 mmHg/L/min Therefore, the answer is (C) 5 mmHg/L/min.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Stability of alveoli maintained by?", "options": [{"label": "A", "text": "Residual air", "correct": false}, {"label": "B", "text": "Increase surface area by surfactant", "correct": true}, {"label": "C", "text": "Negative intra pleural pressure", "correct": false}, {"label": "D", "text": "Lung compliance", "correct": false}], "correct_answer": "B. Increase surface area by surfactant", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Increase surface area by surfactant The stability of alveoli is maintained by the presence of surfactant, which reduces surface tension within the alveoli, allowing them to remain open during expiration. Therefore, option (B) \"increase surface area by surfactant\" is the correct answer.</p>\n<p><strong>Highyeild:</strong></p><p>If the air passages leading from the alveoli of the lungs are blocked, the surface tension in the alveoli tends to collapse the alveoli. This collapse creates positive pressure in the alveoli, attempting to push the air out. For the average-sized alveolus with a radius of about 100 micrometers and lined with the normal surfactant, this calculates to be about 4 centimeters of water pressure (3 mm Hg). If the alveoli were lined with pure water without any surfactant, the pressure would be calculated to be about 18 centimeters of water pressure—4.5 times as great. Thus, one sees the importance of surfactants in reducing alveolar surface tension and therefore also reducing the effort required by the respiratory muscles to expand the lungs.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Residual air (A) refers to the air that remains in the lungs after expiration and helps to maintain lung volume, but it does not contribute to alveolar stability. Negative intrapleural pressure (C) helps to expand the lungs during inspiration, but it also does not contribute to alveolar stability . Lung compliance (D) refers to the ability of the lungs to stretch and expand in response to changes in pressure, but it does not specifically maintain the stability of the alveoli.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 18 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A healthy, 24-year-old man is prescribed sustained-release bupropion (Zyban) for smoking cessation. Twenty-one days after therapy he presents to his family physician with intermittent fever and a generalized rash, at which point the bupropion therapy is discontinued. A month later he develops a dry, intermittent cough and dyspnea. Which of the following pulmonary function test results is consistent with a diagnosis of allergic bronchospasm?", "options": [{"label": "A", "text": "An increased forced vital capacity", "correct": false}, {"label": "B", "text": "A decreased FEV1/FVC", "correct": true}, {"label": "C", "text": "An increased diffusing capacity", "correct": false}, {"label": "D", "text": "A decreased residual volume", "correct": false}], "correct_answer": "B. A decreased FEV1/FVC", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>A decreased FEV1/FVC A decreased FEV1/FVC is consistent with a diagnosis of allergic bronchospasm. Allergic bronchospasm is a type of asthma triggered by an allergic reaction. It causes inflammation and narrowing of the airways, leading to difficulty breathing, coughing, and wheezing. Pulmonary function tests can be used to diagnose and monitor allergic bronchospasm.</p>\n<p><strong>Highyeild:</strong></p><p>FEV1/FVC is the ratio of forced expiratory volume in one second (FEV1) to forced vital capacity (FVC). In allergic bronchospasm, the airways are narrowed, resulting in a decrease in both FEV1 and FVC. However, because FVC decreases less than FEV1, the ratio of FEV1/FVC decreases, indicating airflow limitation. Therefore, a decreased FEV1/FVC is consistent with a diagnosis of allergic bronchospasm.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- The other options listed, including an increased forced vital capacity, an increased diffusing capacity, and a decreased residual volume, are not typical findings in allergic bronchospasm.</p>\n<p><strong>Extraedge:</strong></p><p>Bronchospasm increases the resistance to airflow, which makes it more difficult to expel gas rapidly from the lung during expiration, so although both FEV1 and vital capacity decrease, the percent of gas expelled in 1 second as a function of the total amount that can be expelled (the FEV1/FVC ratio) also decreases dramatically. The obstructive disease also produces air trapping, which increases the residual volume, functional residual capacity, and total lung capacity. FEV1/FVC in disease: The ratio decreases in COPD and is used to assess the severity of the disease: 60-70%: Mild COPD 50-60%: Moderate COPD < 50%: Severe COPD If bronchodilator response to beta 2 agonists is there: means if there is >15% increase in FEV1: Points towards asthma.</p>\n<p><strong>Table:</strong></p><p>FLOW-VOLUME\n PARAMETER Obstructive\n lung disease Restrictive\n lung disease RV ↑ ↓ FRC ↑ ↓ TLC ↓↓ ↓ FEV ↓ ↓ FVC ↓ ↓ FEV /FVC FEV,\n decreased more than FVC Normal or\n ↑ FEV,\n decreased proportionately to FVC</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The diagram below illustrates the intrapleural pressure generated by a patient during a forced expiration. The equal pressure point will move closer to the mouth and the forced expiratory volume will increase if there is an increase in which of the following?", "options": [{"label": "A", "text": "Inspired lung volume", "correct": true}, {"label": "B", "text": "Lung compliance", "correct": false}, {"label": "C", "text": "Airway resistance", "correct": false}, {"label": "D", "text": "Expiratory effort", "correct": false}], "correct_answer": "A. Inspired lung volume", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Inspired lung volume The equal pressure point is the point at which the pressure inside the airways equals the intrapleural pressure. The intra-airway pressure closest to the alveoli equals the sum of the recoil pressure (exerted by the alveoli) and the intrapleural pressure (produced by the muscles of expiration).</p>\n<p><strong>Highyeild:</strong></p><p>The equal pressure point moves further away from the lungs if the recoil force is increased and moves closer to the lungs when the intrapleural pressure is increased. Increasing the lung volume expands the alveoli, making their recoil force greater and the intrapleural pressure less (more negative). This moves the equal pressure point toward the mouth. If airway resistance increases by increasing airway smooth muscle tone or increasing lung compliance, then a greater expiratory effort and consequently a greater intrapleural pressure will be necessary to expel the gas from the lungs. The higher intrapleural pressure when airway resistance is increased will cause the equal pressure point to be reached closer to the alveoli, decreasing the volume of gas exhaled, and increasing residual volume due to air trapping behind the compressed airways.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option C, would impede airflow and make expiration more difficult. An increase in inspired lung volume, An increase in expiratory effort, as in option D, may help to overcome airway resistance, but would not affect the EPP directly.</p>\n<p><strong>Table:</strong></p><p>FLOW-VOLUME\n PARAMETER Obstructive\n lung disease Restrictive\n lung disease RV ↑ ↓ FRC ↑ ↓ TLC ↓↓ ↓ FEV ↓ ↓ FVC ↓ ↓ FEV /FVC FEV,\n decreased more than FVC Normal or\n ↑ FEV,\n decreased proportionately to FVC</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "In the maximal expiratory flow-volume curves below, Curve A would be typical of which of the following clinical presentations?", "options": [{"label": "A", "text": "A 75-year-old man who has smoked two packs of cigarettes per day for 60 years. His breath sounds are decreased bilaterally, and his chest X-ray shows flattening of the diaphragm", "correct": true}, {"label": "B", "text": "A 68-year-old man presents with a dry cough that has persisted for 3 months. His chest X-ray shows opacities in the lower and middle lung fields. The man states he was exposed to asbestos for approximately 10 years when he worked in a factory in his thirties", "correct": false}, {"label": "C", "text": "A 57-year-old woman with pulmonary fibrosis, presents to the emergency room with shortness of breath", "correct": false}, {"label": "D", "text": "An 84-year-old woman with a history of myocardial infarction, reports shortness of breath that worsens in the recumbent position", "correct": false}], "correct_answer": "A. A 75-year-old man who has smoked two packs of cigarettes per day for 60 years. His breath sounds are decreased bilaterally, and his chest X-ray shows flattening of the diaphragm", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>A 75-year-old man who has smoked two packs of cigarettes per day for 60 years. His breath sounds are decreased bilaterally, and his chest X-ray shows flattening of the diaphragm The description of decreased breath sounds bilaterally and flattening of the diaphragm on chest X-ray are consistent with chronic obstructive pulmonary disease (COPD), which is a common consequence of long-term smoking. The flattened diaphragm is likely due to hyperinflation of the lungs, which is common in COPD.</p>\n<p><strong>Highyeild:</strong></p><p>Cigarette smoking is the major cause of the chronic obstructive pulmonary disease (COPD). In obstructive lung diseases, the increase in airway resistance causes a decrease in expiratory flow rates and air-trapping, which results in an increased residual volume, and thus total lung capacity. This hyperinflation pushes the diaphragm into a flattened position. Asbestosis and pulmonary fibrosis are restrictive lung diseases, in which Curve C would be the typical maximal expiratory flow-volume (MEFV) curve. The decreased effort would decrease flow rates during the effort-dependent portion of a MEFV curve, but not during the effort-independent portion.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B: describes a patient with a history of asbestos exposure and opacities on chest X-ray , which is suggestive of asbestosis, a type of occupational lung disease. Option C: describes a patient with pulmonary fibrosis, which is a broad term that describes scarring of the lung tissue. Causes of pulmonary fibrosis can include environmental exposures, autoimmune diseases, and certain medications. Option D: describes a patient with shortness of breath that worsens in the recumbent position, which is suggestive of paroxysmal nocturnal dyspnea, a symptom commonly associated with heart failure .</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 49-year-old coal miner presents with dyspnea, a nonproductive cough, and decreased exercise tolerance. Lung function tests reveal: total lung capacity = 3.34 L (56% of predicted), residual volume = 0.88 L (54% of predicted), and forced vital capacity = 1.38 L (30% of predicted). His arterial PO2 is 68 mmHg. Which of the following values will be approximately normal?", "options": [{"label": "A", "text": "FEV1/FVC ratio", "correct": true}, {"label": "B", "text": "Tidal volume", "correct": false}, {"label": "C", "text": "V/Q ratio", "correct": false}, {"label": "D", "text": "Diffusing capacity", "correct": false}], "correct_answer": "A. FEV1/FVC ratio", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>FEV1/FVC ratio In this patient, the lung function tests show a decrease in total lung capacity, residual volume, and forced vital capacity, which is consistent with restrictive lung disease . The decreased arterial PO2 also suggests impaired gas exchange.</p>\n<p><strong>Highyeild:</strong></p><p>The FEV1/FVC ratio, which is the ratio of the forced expiratory volume in one second to the forced vital capacity, is a measure of airflow obstruction and is typically reduced in obstructive lung diseases such as chronic obstructive pulmonary disease (COPD). However, in restrictive lung disease, the FEV1/FVC ratio is often preserved or even increased, as both the FEV1 and FVC are decreased proportionally.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A . The tidal volume, which is the volume of air inspired or expired during normal breathing, may be decreased in restrictive lung disease but can also be maintained if the patient increases the frequency of breathing to compensate for the decreased lung capacity. Option B. The V˙/Q˙ ratio, which is the ratio of ventilation to perfusion in the lungs, can be altered in various lung diseases and is not a specific indicator of restrictive or obstructive lung disease. Option D. The diffusing capacity, which is a measure of the ability of the lungs to transfer gasses from the air to the blood, may also be decreased in restrictive lung disease due to the reduced surface area for gas exchange.</p>\n<p><strong>Extraedge:</strong></p><p>Patients with restrictive lung disease have small tidal volumes. The diffusing capacity will be reduced because the small lung volumes reduce the surface area available for gas exchange, and the fibrotic changes in the lungs increase the thickness of the diffusion barrier. The presence of V/Q abnormalities is indicated by the need for supplemental oxygen.</p>\n<p><strong>Table:</strong></p><p>FLOW-VOLUME\n PARAMETER Obstructive\n lung disease Restrictive\n lung disease RV ↑ ↓ FRC ↑ ↓ TLC ↓↓ ↓ FEV ↓ ↓ FVC ↓ ↓ FEV /FVC FEV,\n decreased more than FVC Normal or\n ↑ FEV,\n decreased proportionately to FVC</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 68-year-old woman with pulmonary fibrosis, who presents with a complaint of increasing dyspnea while performing activities of daily living, is referred for pulmonary function testing. Which of the following laboratory values is consistent with her diagnosis?", "options": [{"label": "A", "text": "Decreased diffusing capacity of the lung", "correct": true}, {"label": "B", "text": "Increased residual volume", "correct": false}, {"label": "C", "text": "Decreased FEV1/FVC", "correct": false}, {"label": "D", "text": "Increased lung compliance", "correct": false}], "correct_answer": "A. Decreased diffusing capacity of the lung", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Decreased diffusing capacity of the lung Pulmonary fibrosis is a condition that results in the scarring of lung tissue, which can lead to a decrease in lung function and impaired gas exchange. Therefore, in this patient with pulmonary fibrosis, the scarring of lung tissue can reduce the surface area available for gas exchange, resulting in a decreased DLCO.</p>\n<p><strong>Highyeild:</strong></p><p>Pulmonary fibrosis causes stiff lungs and is characterized by a decrease in lung compliance and an increase in lung elastic recoil. This results in pulmonary function findings typical of a restrictive impairment, including a decrease in all lung volumes and capacities and a ratio of the forced expiratory volume exhaled in one second (FEV1) to the total forced vital capacity (FVC) that is normal or increased.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B . Increased residual volume, which is the volume of air remaining in the lungs after maximal expiration, is more commonly seen in obstructive lung diseases such as chronic obstructive pulmonary disease (COPD), rather than restrictive lung diseases such as pulmonary fibrosis. Option C. Decreased FEV1/FVC, which is the ratio of the forced expiratory volume in one second to the forced vital capacity, is a measure of airflow obstruction and is typically reduced in obstructive lung diseases such as COPD, rather than restrictive lung diseases such as pulmonary fibrosis. Option D . Increased lung compliance, which is the ease with which the lungs can be stretched, is not a typical finding in pulmonary fibrosis, as the scarring of lung tissue can make the lungs less compliant and stiffer.</p>\n<p><strong>Extraedge:</strong></p><p>Idiopathic pulmonary fibrosis Progressive fibrotic lung disease of unknown etiology. May involve multiple cycles of lung injury, inflammation, and fibrosis. Associated with cigarette smoking, environmental pollutants, genetic defects. Findings: progressive dyspnea, fatigue, nonproductive cough, crackles, clubbing. Imaging shows peripheral reticular opacities with traction bronchiectasis +/- \"honeycomb\" appearance of lung (advanced disease). Histologic pattern: usual interstitial pneumonia. Complications: pulmonary hypertension, right heart failure, arrhythmias, coronary artery disease, respiratory failure, lung cancer.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 66-year-old woman with pulmonary fibrosis presents with a complaint of increasing dyspnea while performing activities of daily living. She is referred for pulmonary function testing to assess the progression of her disease. Which of the following laboratory values is consistent with her diagnosis?", "options": [{"label": "A", "text": "Decreased diffusing capacity of the lung", "correct": true}, {"label": "B", "text": "Increased residual volume", "correct": false}, {"label": "C", "text": "Decreased forced expiratory volume exhaled in 1 second (FEV1)/forced vital capacity (FVC)", "correct": false}, {"label": "D", "text": "Increased airway resistance corrected for lung volume", "correct": false}], "correct_answer": "A. Decreased diffusing capacity of the lung", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Decreased diffusing capacity of the lung In pulmonary fibrosis, the diffusing capacity of the lung is decreased due to an increase in the thickness of the diffusional barrier, as predicted by the Fick’s law of diffusion.</p>\n<p><strong>Highyeild:</strong></p><p>Pulmonary fibrosis is characterized by a decrease in lung compliance and an increase in lung elastic recoil (stiff lungs), which results in findings typical of restrictive impairment.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option. B: Pulmonary function test values characteristic of a restrictive impairment include a decrease in all lung volumes and capacities Option. C: A ratio of the FEV1 to the total FVC that is normal or increased. Option D: Airway radius is decreased, and thus airway resistance is increased, at lower lung volumes, but in restrictive disorders, the airway resistance is normal when corrected for lung volume in contrast to obstructive disorders, in which an increased airway resistance is a hallmark of the functional impairment.</p>\n<p><strong>Extraedge:</strong></p><p>Idiopathic pulmonary fibrosis Progressive fibrotic lung disease of unknown etiology. May involve multiple cycles of lung injury, inflammation, and fibrosis. Associated with cigarette smoking, environmental pollutants, genetic defects. Findings: progressive dyspnea, fatigue, nonproductive cough, crackles, clubbing. Imaging shows peripheral reticular opacities with traction bronchiectasis +/- \"honeycomb\" appearance of lung (advanced disease). Histologic pattern: usual interstitial pneumonia. Complications: pulmonary hypertension, right heart failure, arrhythmias, coronary artery disease, respiratory failure, lung cancer.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 47-year-old male visits the hospital complaining of shortness of breath which has increased since a few hours. Seeing the patient's old reports you realized that the patient is an old case of obstructive lung disease. The shortness of breath in this patient is due to what reason/s?", "options": [{"label": "A", "text": "Increased residual volume", "correct": false}, {"label": "B", "text": "Decreased expiratory reserve volume", "correct": false}, {"label": "C", "text": "Air trapping", "correct": false}, {"label": "D", "text": "All of the above", "correct": true}], "correct_answer": "D. All of the above", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>All of the above In a patient with obstructive lung disease who presents with shortness of breath, all of the above factors - increased residual volume, decreased expiratory reserve volume, and air trapping - can contribute to the difficulty in breathing.</p>\n<p><strong>Highyeild:</strong></p><p>Obstructive lung disease is a condition that affects airflow in and out of the lungs, making it difficult to breathe. It is typically characterized by increased airway resistance, which can result in a number of physiological changes in the lungs. In OLD due to the early closure of airways, there is air trapping inside the lungs which becomes part of the residual volume consequently increasing the residual volume and decreasing the expiratory reserve volume.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A . Increased residual volume, which is the volume of air remaining in the lungs after maximal expiration, is a common finding in obstructive lung disease. This is because the airways become narrowed, making it difficult to exhale all of the air from the lungs. Option B . Decreased expiratory reserve volume, which is the volume of air that can be forcibly exhaled after a normal expiration, is also commonly seen in obstructive lung disease. This is because the narrowed airways make it difficult to exhale a sufficient amount of air during forced exhalation. Option C . Air trapping, which is the retention of air in the lungs during expiration, is another common feature of obstructive lung disease. This occurs because the narrowed airways make it difficult to completely empty the lungs during exhalation, leading to the retention of air.</p>\n<p><strong>Table:</strong></p><p>FLOW-VOLUME\n PARAMETER Obstructive\n lung disease Restrictive\n lung disease RV ↑ ↓ FRC ↑ ↓ TLC ↓↓ ↓ FEV ↓ ↓ FVC ↓ ↓ FEV /FVC FEV,\n decreased more than FVC Normal or\n ↑ FEV,\n decreased proportionately to FVC</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 76-year-old lady was brought to the emergency department by her son. The lady was breathing profusely and couldn’t even speak a few words together. She has anxiety and a productive cough with frothy sputum. Her old reports say she had MI a year ago with a subsequent coronary artery bypass. Her vital signs are: BP - 100/80mmHg RR - 30 Heart rate - 110 On auscultation, you hear a crackle sound while she has inspiration. X-ray was done and it came out to be pulmonary edema. What else features, in this case, can be expected?", "options": [{"label": "A", "text": "Decreased pulmonary artery pressure", "correct": false}, {"label": "B", "text": "Decreased pulmonary lymph flow", "correct": false}, {"label": "C", "text": "Increased pulmonary venous pressure", "correct": true}, {"label": "D", "text": "Increased vital capacity", "correct": false}], "correct_answer": "C. Increased pulmonary venous pressure", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Increased pulmonary venous pressure In this case, the patient has signs and symptoms consistent with acute pulmonary edema, which is caused by the accumulation of fluid in the lungs due to increased pulmonary venous pressure . This can occur as a result of heart failure, which can be associated with a history of myocardial infarction and coronary artery bypass surgery.</p>\n<p><strong>Highyeild:</strong></p><p>As a result of left heart failure, fluid backs up into the lungs and increases pulmonary venous and capillary pressure which leads to increased filtration and edema formation. The crackles heard on auscultation are also consistent with fluid accumulation in the lungs. The patient's vital signs indicate respiratory distress, with tachypnea and tachycardia.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A: pulmonary pressure will not decrease but it will increase as fluid back up towards the right heart. Option B: Pulmonary lymph will also increase as filtration increases. Option D: since there is pulmonary edema so vital capacity will decrease because edema will interfere with lung inflation.</p>\n<p><strong>Table:</strong></p><p>FLOW-VOLUME\n PARAMETER Obstructive\n lung disease Restrictive\n lung disease RV ↑ ↓ FRC ↑ ↓ TLC ↓↓ ↓ FEV ↓ ↓ FVC ↓ ↓ FEV /FVC FEV,\n decreased more than FVC Normal or\n ↑ FEV,\n decreased proportionately to FVC</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "When the respiratory muscles are relaxed, the lungs are at which of the following?", "options": [{"label": "A", "text": "Functional residual capacity (FRC)", "correct": true}, {"label": "B", "text": "Expiratory reserve volume (ERV)", "correct": false}, {"label": "C", "text": "Residual volume (RV)", "correct": false}, {"label": "D", "text": "Inspiratory reserve volume (IRV)", "correct": false}], "correct_answer": "A. Functional residual capacity (FRC)", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Functional residual capacity (FRC) When the respiratory muscles are relaxed, the lungs are at functional residual capacity (FRC), which is the volume of air remaining in the lungs after a normal expiration. At FRC, the inward recoil of the lungs is balanced by the outward recoil of the chest wall.</p>\n<p><strong>Highyeild:</strong></p><p>The functional residual capacity (FRC) occurs at the lung volume at which the outward recoil of the chest wall is equal to the inward recoil of the lungs, which occurs when no respiratory muscles are actively contracting, that is, at the end of a tidal expiration.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- The other options (ERV, RV, and IRV) refer to different lung volumes that occur during breathing maneuvers.</p>\n<p><strong>Table:</strong></p><p>Lung\n volumes and capacities Note: a\n capacity is a sum of ≥ 2 physiologic volumes. There are 4 volumes and 4\n capacities. Tidal volume Air that\n moves into lung with each quiet inspiration, 6 - 8mL / k * g typically ~500\n mL. Inspiratory\n reserve volume Air that\n can still be breathed in after normal inspiration Expiratory\n reserve volume Air that\n can still be breathed out after normal expiration Residual\n volume Air in\n lung after maximal expiration; RV and any lung capacity that includes RV\n cannot be measured by spirometry Inspiratory\n capacity IRV + VT Air that\n can be breathed in after normal exhalation Functional\n residual capacity IRV + VT Air that\n can be breathed in after normal exhalation Vital\n capacity IRV + VT\n + ERV Maximum\n volume of gas that can be expired after a maximal inspirationRV + ERV Volume of\n gas in lungs after normal expiration; outward pulling force of chest wall is\n balanced with inward collapsing force of lungs Total\n lung capacity IRV + VT\n + ERV + RV = VC + RV Volume of\n gas present in lungs after a maximal inspiration</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "In a 58-year-old woman with difficulty breathing, the TLC and FRC are lower than normal and FEV1/FVC is slightly higher than normal. These findings are most consistent with which of the following?", "options": [{"label": "A", "text": "Increased chest wall elastic recoil", "correct": false}, {"label": "B", "text": "Decreased Strength Of The Chest Wall Muscles", "correct": false}, {"label": "C", "text": "Increased Airway Resistance", "correct": false}, {"label": "D", "text": "Increased lung elastic recoil", "correct": true}], "correct_answer": "D. Increased lung elastic recoil", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Increased lung elastic recoil A lung with increased elastic recoil (decreased compliance) will be harder to fill on inspiration and will tend to pull the chest wall inward on relaxation of the muscles of breathing . Thus, both TLC and FRC will be decreased. Because airway radius is normal or even increased, FEV1 normalized to FVC will be normal or increased even though FVC will be reduced. Decreased muscle strength could cause a decrease in TLC, but it would not alter FRC.</p>\n<p><strong>Highyeild:</strong></p><p>Changes in FRC point toward changes in lung and chest wall structure such as those caused by pulmonary fibrosis. Decreases in forced airflow, especially normalized to FVC, point toward increased airway resistance such as that seen in asthma, bronchitis, and emphysema.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A: Increased chest wall elastic recoil would likely result in increased TLC and FRC , but not necessarily an increase in FEV1/FVC ratio. Option B: Decreased strength of the chest wall muscles would likely result in decreased lung volumes and reduced FEV1/FVC ratio. Option C: Increased airway resistance would result in decreased FEV1/FVC ratio, but not necessarily a decrease in TLC and FRC.</p>\n<p><strong>Table:</strong></p><p>FLOW-VOLUME\n PARAMETER Obstructive\n lung disease Restrictive\n lung disease RV ↑ ↓ FRC ↑ ↓ TLC ↓↓ ↓ FEV ↓ ↓ FVC ↓ ↓ FEV /FVC FEV,\n decreased more than FVC Normal or\n ↑ FEV,\n decreased proportionately to FVC</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 20 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A 6 feet 3 inches tall, 140-kg, 20-year-old male was watching television when he felt pain in his shoulder blades, shortness of breath, and fatigue. His father noticed how pale he was and took him to the Emergency Department, where a chest X-ray revealed a 55% pneumothorax of the right lung due to the rupture of a bleb on the surface of the lung. Which of the following is true?", "options": [{"label": "A", "text": "The intrapleural pressure in the affected area is equal to the atmospheric pressure", "correct": true}, {"label": "B", "text": "The chest wall on the affected side recoils inward", "correct": false}, {"label": "C", "text": "There is hyperinflation in the affected lung", "correct": false}, {"label": "D", "text": "The V˙/Q˙ ratio on the affected side is higher than normal", "correct": false}], "correct_answer": "A. The intrapleural pressure in the affected area is equal to the atmospheric pressure", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The intrapleural pressure in the affected area is equal to the atmospheric pressure In a pneumothorax, air enters the pleural cavity between the parietal and visceral pleura, causing the lung to collapse. The intrapleural pressure in the affected area is equal to atmospheric pressure because the pressure in the pleural cavity becomes equal to atmospheric pressure. This means there is no pressure gradient to keep the lung inflated.</p>\n<p><strong>Highyeild:</strong></p><p>When air enters the pleural space due to interruption of the pleural surface through either the rupture of the lung or a hole in the chest wall, the pressure in the pleural space becomes atmospheric, and the lung on the affected side collapses because of the lung’s tendency to recoil inward, and the chest wall on the affected side recoils outward.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. The chest wall on the affected side recoils outward, and there is a decrease in lung volume due to the collapse of the lung. Option C. Hyperinflation of the remaining lung may occur in a compensatory effort to maintain gas exchange. Option D . With the collapse of the lung, the V ˙/Q ˙ ratio on the affected side decreases.</p>\n<p><strong>Table:</strong></p><p>Ventilation/perfusion\n mismatch Ideally, ventilation (V)\n is matched to perfusion (Q) per minute (ie, dot V / dot Oratio = 1 ) for\n adequate gas exchange. Lung zones: VIO at apex of lung = 3 (wasted\n ventilation) VIO at base of lung = 0.6\n (wasted perfusion) Both ventilation and perfusion are greater at the base of\n the lung than at the apex of the lung. With exercise (t cardiac output),\n there is vasodilation of apical capillaries dot V / O ratio approaches 1. Certain organisms that\n thrive in high O_{2} (eg, TB) flourish in the apex. dot V / dot Q =0=^ ``\n oirway \" obstruction (shunt). In shunt, 100% O_{2} does not improve Pao,\n (eg, foreign body aspiration). dot V / dot O = ∞ = blood\n flow obstruction (physiologic dead space). Assuming < 100% dead space,\n 100% O_{2} improves Pao, (eg, pulmonary embolus).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Lung ventilation in a person is increased as a result of physical activity. Which of the following indices of external respiration is much higher than in a state of rest?", "options": [{"label": "A", "text": "Inspiratory Reserve Volume", "correct": false}, {"label": "B", "text": "Expiratory Reserve Volume", "correct": false}, {"label": "C", "text": "Total lung capacity", "correct": false}, {"label": "D", "text": "Respiratory volume", "correct": true}], "correct_answer": "D. Respiratory volume", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Respiratory volume The correct answer is D. Respiratory volume. During physical activity, the respiratory volume (also known as tidal volume) increases to allow for increased oxygen uptake and carbon dioxide elimination. This is because the body's demand for oxygen and energy increases during exercise. Therefore, D. Respiratory volume is the index of external respiration that is much higher during physical activity than in a state of rest.</p>\n<p><strong>Highyeild:</strong></p><p>During physical exercises, the sympathetic nervous system causes dilation of the bronchi, therefore, the respiratory volume (tidal volume) that a person inhales and exhales increases.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Options A. & B. The inspiratory reserve volume and expiratory reserve volume are the additional volumes of air that can be inhaled or exhaled beyond the normal tidal volume. These volumes may increase slightly during exercise, but not as much as the tidal volume. Option C. The total lung capacity is the maximum amount of air the lungs can hold, including the tidal volume, inspiratory reserve volume, and expiratory reserve volume. This may increase slightly during exercise, but not as much as the tidal volume.</p>\n<p><strong>Table:</strong></p><p>Lung\n volumes and capacities Note: a\n capacity is a sum of ≥ 2 physiologic volumes. There are 4 volumes and 4 capacities. Tidal\n volume Air that\n moves into lung with each quiet inspiration, 6 - 8mL / k * g typically ~500\n mL. Inspiratory\n reserve volume Air that\n can still be breathed in after normal inspiration Expiratory\n reserve volume Air that\n can still be breathed out after normal expiration Residual\n volume Air in\n lung after maximal expiration; RV and any lung capacity that includes RV\n cannot be measured by spirometry</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "With regard to lung ventilation, what does “dead space” refer to?", "options": [{"label": "A", "text": "air in the conducting zone of the bronchial tree", "correct": true}, {"label": "B", "text": "air remaining in the alveoli after an exhalation at maximal effort.", "correct": false}, {"label": "C", "text": "the air between the parietal and visceral pleura", "correct": false}, {"label": "D", "text": "the difference between the volume of a maximum inhalation and the tidal volume.", "correct": false}], "correct_answer": "A. air in the conducting zone of the bronchial tree", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>air in the conducting zone of the bronchial tree Dead space refers to air that is inhaled into the airways but does not reach the alveoli, hence is exhaled again without participating in gas exchange. Therefore, the correct answer is A. Air in the conducting zone of the bronchial tree.</p>\n<p><strong>Highyeild:</strong></p><p>Dead space refers to air in the conducting zone of the bronchial tree that does not participate in gas exchange with the blood. The conducting zone includes the trachea, bronchi, and bronchioles, and the air within this zone is not involved in gas exchange because it does not come into contact with the blood in the pulmonary capillaries. This dead space is necessary for air to reach the alveoli, where gas exchange can occur.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. Air remaining in the alveoli after an exhalation at maximal effort is called residual volume, and it is not considered part of dead space. Option C . Air between the parietal and visceral pleura is known as pleural fluid, and it does not play a role in lung ventilation or gas exchange. Option D. The difference between the volume of a maximum inhalation and the tidal volume is called inspiratory reserve volume and is not related to dead space.</p>\n<p><strong>Table:</strong></p><p>Lung\n volumes and capacities Note: a\n capacity is a sum of ≥ 2 physiologic volumes. There are 4 volumes and 4\n capacities. Tidal\n volume Air that\n moves into lung with each quiet inspiration, 6 - 8mL / k * g typically ~500\n mL. Inspiratory\n reserve volume Air that\n can still be breathed in after normal inspiration Expiratory\n reserve volume Air that\n can still be breathed out after normal expiration Residual\n volume Air in\n lung after maximal expiration; RV and any lung capacity that includes RV\n cannot be measured by spirometry</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 13 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A hospitalized patient has tachypnea and significantly labored respirations requiring mechanical ventilation. Based on the pressure-volume curve of the lungs shown as Curve Z in the figure below, which of the following is the most likely diagnosis for the patient?", "options": [{"label": "A", "text": "Emphysema", "correct": false}, {"label": "B", "text": "Asthma", "correct": false}, {"label": "C", "text": "Dyspnea with aging", "correct": false}, {"label": "D", "text": "Pulmonary edema", "correct": true}], "correct_answer": "D. Pulmonary edema", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Pulmonary edema Lung compliance is defined as the ease with which the lungs are expanded and is calculated as the change in volume per change in pressure (∆V/∆P), which is the slope of the pressure-volume curve of the lung. Thus, Curve Z is the pressure-volume curve of an individual with a decrease in lung compliance. The abnormal accumulation of fluid in the lungs (pulmonary edema) causes a restrictive pulmonary impairment characterized by decreased lung compliance. An L/S ratio ≥2 indicates normal biochemical maturation of the lung, with normal surfactant production and lung compliance (normal curve). If the L/S ratio is less than 2, there is an increased incidence of respiratory distress syndrome in the newborn, which would be represented by Curve Z.</p>\n<p><strong>Highyeild:</strong></p><p>In fibrosis the lungs become stiff, making a large pressure necessary to maintain a moderate volume. Such lungs would be considered poorly compliant. However, in emphysema, where many alveolar walls are lost, the lungs become so loose and floppy that only a small pressure difference is necessary to maintain a large volume. Thus, the lungs in emphysema would be considered highly compliant.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Emphysema & C. Dyspnea: with aging: Aging and emphysema are characterized by an increase in lung compliance (Curve X), which increases airway resistance. Option B . Asthma: The increase in airway resistance in asthma is not associated with an increase (or decrease) in lung compliance.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 57-year-old female presents with dyspnea on exertion. Pulmonary function studies with plethysmography demonstrate an increase in the work of breathing, and oxygen consumption is higher-than-normal at rest. Which of the following will decrease the oxygen consumption of the respiratory muscles?", "options": [{"label": "A", "text": "A decrease in lung compliance", "correct": false}, {"label": "B", "text": "A decrease in airway resistance", "correct": true}, {"label": "C", "text": "A decrease in the diffusing capacity of the lung", "correct": false}, {"label": "D", "text": "An increase in the rate of respiration", "correct": false}], "correct_answer": "B. A decrease in airway resistance", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>A decrease in airway resistance When airway resistance is high, the respiratory muscles have to work harder to move air in and out of the lungs. This increased work of breathing can lead to an increase in oxygen consumption by the respiratory muscles, which can contribute to dyspnea on exertion. Therefore airway resistance is decreased, and the work of breathing will be reduced, which can decrease the oxygen consumption of the respiratory muscles. This can help to alleviate dyspnea on exertion.</p>\n<p><strong>Highyeild:</strong></p><p>Respiratory muscles consume oxygen in proportion to the work of breathing. The work of breathing is equal to the product of the change in volume for each breath and the change in pressure necessary to overcome the resistive work of breathing and the elastic work of breathing. Resistive work includes work to overcome tissue as well as airway resistance; thus a decreased airway resistance will decrease the work of breathing and the oxygen consumption of the respiratory muscles.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. A decrease in lung compliance: A decreased lung compliance would increase the elastic work of breathing. Option C. A decrease in the diffusing capacity of the lung: Will increase the work of breathing by increasing the respiratory rate to compensate for the decreased diffusing capacity Option D . An increase in the rate of respiration: An increase in respiratory rate or tidal volume increases the work of breathing.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following statements is true in the case of asthma:", "options": [{"label": "A", "text": "Increased FRC; Reduced Residual Volume", "correct": false}, {"label": "B", "text": "Increased FRC; Increased Residual Volume", "correct": true}, {"label": "C", "text": "Reduced FRC; Reduced Residual Volume", "correct": false}, {"label": "D", "text": "Reduced FRC; Increased Residual Volume", "correct": false}], "correct_answer": "B. Increased FRC; Increased Residual Volume", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Increased FRC; Increased Residual Volume Increased FRC; Increased Residual Volume is true in the case of asthma. In asthma, there is an obstruction of the airways due to inflammation and bronchospasm, which can lead to air trapping in the lungs. This results in an increase in functional residual capacity (FRC), which is the volume of air remaining in the lungs after a normal expiration, and an increase in residual volume (RV), which is the volume of air remaining in the lungs after a maximal expiration.</p>\n<p><strong>Highyeild:</strong></p><p>Asthma is a chronic respiratory disease characterized by airway inflammation and bronchoconstriction, which can lead to increased airway resistance and reduced airflow. During an asthma attack or exacerbation, the airways become narrowed, making it harder for air to flow in and out of the lungs. As a result of this narrowing, the volume of air that remains in the lungs after a maximal exhalation, known as residual volume, increases. The increased airway resistance also causes air to be trapped in the lungs at the end of a normal exhalation, leading to an increase in functional residual capacity (FRC), which is the volume of air that remains in the lungs at the end of a normal breath. Therefore, the correct answer is B. Increased FRC; Increased Residual Volume.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A is not correct in the case of asthma. An increased FRC is seen in asthma due to air trapping caused by bronchospasm and inflammation of the airways. Option C is not correct in the case of asthma. Option C is incorrect as it suggests a reduced FRC and a reduced residual volume, which is not consistent with the pathophysiology of asthma. Option D is not correct in the case of asthma. Asthma is characterized by airway obstruction due to inflammation and bronchospasm, which leads to air trapping and an increase in the amount of air that remains in the lungs after a normal expiration . This results in an increase in the functional residual capacity ( FRC ) and an increase in the residual volume ( RV ).</p>\n<p><strong>Extraedge:</strong></p><p>In diseases with airway obstruction, it is usually much more difficult to expire than to inspire because the closing tendency of the airways is greatly increased by the extra positive pressure required in the chest to cause expiration. By contrast, the extra negative pleural pressure that occurs during inspiration actually “pulls” the airways open at the same time that it expands the alveoli. Therefore, air tends to enter the lung easily but then becomes trapped in the lungs. Over a period of months or years, this effect increases both the TLC and the RV. The classic disease that causes severe airway obstruction is asthma.</p>\n<p><strong>Table:</strong></p><p>Obstructive lung diseases Obstruction of air flow († FRC, ↑ RV, ↑ TLC) →\nair trapping in lungs with premature airway closure at high lung volumes (↓↓\nFEV,, ↓ FVC ↓ FEV/FVC ratio). Leads to V/Q mismatch.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Mr. Jitendra complains of shortness of breath and difficulty with moderate exercise. Pulmonary function tests indicate a reduced FRC and his FEV1 was 2.6 L (78%). His FVC was 3.1 L (70%). Which of the following is the most likely cause of Mr. Jitendra's problems?", "options": [{"label": "A", "text": "Weak expiratory muscles", "correct": false}, {"label": "B", "text": "Small-diameter airways", "correct": false}, {"label": "C", "text": "Pulmonary Congestion", "correct": false}, {"label": "D", "text": "Pulmonary fibrosis", "correct": true}], "correct_answer": "D. Pulmonary fibrosis", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Pulmonary fibrosis Pulmonary fibrosis is the most likely cause of Mr. Jitendra's problems. The FEV1 and FVC values indicate that Mr. Jitendra has an obstructive pattern of lung disease. The FEV1/FVC ratio is reduced, indicating that air is trapped in the lungs and not flowing out as easily as it should. This is consistent with fibrosis, which can lead to the formation of scar tissue that obstructs the airways.</p>\n<p><strong>Highyeild:</strong></p><p>The first indication is the reduced FRC, suggesting a decrease in lung compliance that would be consistent with a restrictive disease. Generally, changes in rates of change obtained in lung function tests are associated with obstructive disease.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A: Weak expiratory muscles would not cause a reduced FRC or an obstructive pattern of lung disease. Option B : Small-diameter airways would cause an obstructive pattern of lung disease, but it would not cause a reduced FRC. Option C : Pulmonary congestion would cause a reduced FRC, but it would not cause an obstructive pattern of lung disease.</p>\n<p><strong>Extraedge:</strong></p><p>Obstructive disease: Disorders that cause an increase in the airway resist- ance to flow such as narrowing of the passages due to inflammation or compression and obstructive diseases manifest themselves as increased resistance to airflow. Restrictive disease: Disorders that impair or increase the work necessary for lung expansion and restrictive diseases manifest themselves as restriction of lung expansion. Restrictive lung diseases May lead to lung volumes (↓ FVC and TLC). PFTS: normal or ↑ FEV /FVC ratio. Patient presents with short, shallow breaths. Types: • Altered respiratory mechanics (extrapulmonary, normal D normal A-a gradient): LCO o Respiratory muscle weakness-polio, myasthenia gravis, Guillain-Barré syndrome, ALS o Chest wall abnormalities-scoliosis, severe obesity • Diffuse parenchymal lung diseases, also called interstitial lung diseases (pulmonary, Dico, 1 A-a gradient): o Pneumoconioses (eg, coal workers' pneumoconiosis, silicosis, asbestosis) o Sarcoidosis: bilateral hilar lymphadenopathy, noncaseating granulomas; ↑ ACE and Ca²+ o Idiopathic pulmonary fibrosis o Granulomatosis with polyangiitis o Pulmonary Langerhans cell histiocytosis (eosinophilic granuloma) o Hypersensitivity pneumonitis o Drug toxicity (eg, bleomycin, busulfan, amiodarone, methotrexate) o Acute respiratory distress syndromeRadiation-induced lung injury-associated with proinflammatory cytokine release (eg, TNF-α, IL-1, IL-6). May be asymptomatic but most common symptoms are dry cough and dyspnea +/- low-grade fever. Acute radiation pneumonitis develops within 3-12 weeks (exudative phase); radiation fibrosis may develop after 6-12 months.</p>\n<p><strong>Table:</strong></p><p>FLOW-VOLUME PARAMETER Obstructive lung disease Restrictive lung disease RV ↑ ↓ FRC ↑ ↓ TLC ↓↓ ↓ FEV ↓ ↓ FVC ↓ ↓ FEV /FVC FEV, decreased more than\n FVC Normal or ↑ FEV, decreased\n proportionately to FVC</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 14 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A patient complains of paroxysmal episodes of not being able to catch her breath. When no abnormalities are detected with conventional pulmonary function screening, the pulmonologist orders a methacholine challenge test. Which of the following will increase as a result of stimulating cholinergic receptors on the bronchial smooth muscle?", "options": [{"label": "A", "text": "Lung compliance", "correct": false}, {"label": "B", "text": "Airway diameter", "correct": false}, {"label": "C", "text": "Elastic work of breathing", "correct": false}, {"label": "D", "text": "Resistive work of breathing", "correct": true}], "correct_answer": "D. Resistive work of breathing", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Resistive work of breathing Methacholine is a cholinergic agonist, which causes constriction of bronchial smooth muscle. Bronchoconstriction reduces airway radius , which increases airway resistance, and thus the resistive work of breathing.</p>\n<p><strong>Highyeild:</strong></p><p>Methacholine is a cholinergic agonist that acts on muscarinic receptors in the airway smooth muscle, causing bronchoconstriction and increased resistance to airflow. This leads to an increase in the resistive work of breathing, as the patient has to work harder to move air in and out of their lungs.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Lung compliance (A) refers to the ability of the lungs to expand and contract in response to changes in pressure. Methacholine-induced bronchoconstriction is not expected to affect lung compliance. Airway diameter (B) is reduced during bronchoconstriction, which is the goal of the methacholine challenge test. This narrowing of the airways is what leads to the symptoms experienced by the patient. Elastic work of breathing (C) refers to the work done to overcome the elastic recoil of the lungs and chest wall during breathing. Methacholine-induced bronchoconstriction is not expected to affect the elastic work of breathing.</p>\n<p><strong>Table:</strong></p><p>Lung and chest wall Because of historical reasons and small\n pressures, pulmonary pressures are always presented in cm H₂O. Elastic recoil Tendency for lungs to collapse inward and\n chest wall to spring outward. At FRC, airway and alveolar pressures equal\n atmospheric pressure (PB; called zero), and intrapleural pressure is negative\n (preventing atelectasis). The inward pull of the lung is balanced by the\n outward pull of the chest wall. System pressure is atmospheric. Pulmonary\n vascular resistance (PVR) is at a minimum Compliance Change in lung volume for a change in\n pressure (AV/AP). Inversely proportional to wall stiffness and increased by\n surfactant. ↑ compliance = lung easier to fill (eg,\n emphysema, older adults) + compliance = lung more difficult to fill\n (eg, pulmonary fibrosis, pneumonia, ARDS, pulmonary edema) Hysteresis Lung inflation follows a different pressure-\n volume curve than lung deflation due to need to overcome surface tension\n forces in inflation.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A healthy 32-year-old woman undergoes pulmonary exercise stress testing before starting a training regimen in preparation for her first marathon. Normally, during moderate aerobic exercise, which of the following occurs?", "options": [{"label": "A", "text": "PaO2 increases", "correct": false}, {"label": "B", "text": "PaCO2 decreases", "correct": false}, {"label": "C", "text": "Arterial pH decreases", "correct": false}, {"label": "D", "text": "Alveolar ventilation increases", "correct": true}], "correct_answer": "D. Alveolar ventilation increases", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Alveolar ventilation increases During moderate aerobic exercise, the body's oxygen demand increases, leading to an increase in alveolar ventilation to meet this demand. This increase in ventilation helps to increase oxygen uptake and delivery to the tissues, which is necessary for sustained exercise.</p>\n<p><strong>Highyeild:</strong></p><p>During moderate aerobic exercise, oxygen consumption and CO2 production increase, but alveolar ventilation increase in proportion. But during anaerobic exercise, which is reached at workloads that exceed ~60% of the maximal workload (called the anaerobic threshold), there is increased production of muscle lactic acid, which spills over into the circulation, causing an increase in the concentration of blood lactate and a decrease in the pH of the blood.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. PaO2 also increases slightly due to increased oxygen delivery to the lungs Option B. The partial pressure of carbon dioxide (PaCO2) decreases, which can lead to respiratory alkalosis if it drops too low. Option C. However, this is compensated by the kidneys, which excrete bicarbonate, resulting in a slight decrease in arterial pH.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A patient with Wegener’s glomerulonephritis presents with sinusitis and hemoptysis. His chest radiograph shows several large cavitary pulmonary nodules, consistent with ventilation-perfusion imbalance with low V ˙ /Q˙ units. Which of the following will be greater than normal in a patient with a low V˙/Q˙ ratio?", "options": [{"label": "A", "text": "PaCO2", "correct": false}, {"label": "B", "text": "PaO2", "correct": false}, {"label": "C", "text": "A-a gradient", "correct": true}, {"label": "D", "text": "Oxygen dissolved in the blood", "correct": false}], "correct_answer": "C. A-a gradient", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>A-a gradient In a patient with a low V˙/Q˙ ratio, there is a mismatch between ventilation and perfusion , leading to decreased oxygenation of the blood in the affected areas of the lungs. This results in an increased alveolar-arterial (A-a) gradient, which reflects the difference in oxygen tension between the alveoli and the arterial blood.</p>\n<p><strong>Highyeild:</strong></p><p>The A-a gradient is normally small, but it increases in conditions that impair gas exchange, such as in cases of ventilation-perfusion imbalance, leading to hypoxemia. Areas with low V/Q ratios produce hypoxemia or a decreased PaO2, which leads to (a) a decrease in the dissolved oxygen content of the blood and (b) a decrease in PaCO2, due to stimulation of the peripheral chemoreceptors.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- PaCO2 and PaO2 may be normal or abnormal in this condition, depending on the extent and severity of the mismatch. Oxygen dissolved in blood will also be decreased due to hypoxemia.</p>\n<p><strong>Table:</strong></p><p>Ventilation/perfusion\n mismatch Ideally, ventilation (V)\n is matched to perfusion (Q) per minute (ie, dot V / dot Oratio = 1 ) for\n adequate gas exchange. Lung zones: VIO at apex of lung = 3 (wasted\n ventilation) VIO at base of lung = 0.6\n (wasted perfusion) Both ventilation and perfusion are greater at the base of\n the lung than at the apex of the lung. With exercise (t cardiac output),\n there is vasodilation of apical capillaries dot V / O ratio approaches 1. Certain organisms that\n thrive in high O_{2} (eg, TB) flourish in the apex. dot V / dot Q =0=^ ``\n oirway \" obstruction (shunt). In shunt, 100% O_{2} does not improve Pao,\n (eg, foreign body aspiration). dot V / dot O = ∞ = blood\n flow obstruction (physiologic dead space). Assuming < 100% dead space,\n 100% O_{2} improves Pao, (eg, pulmonary embolus).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "In a patterned baby with Respiratory distress syndrome, which type of cell is deficient?", "options": [{"label": "A", "text": "Type 1 alveolar cell", "correct": false}, {"label": "B", "text": "Type 2 alveolar cell", "correct": true}, {"label": "C", "text": "Alveolar capillary endothelial cells", "correct": false}, {"label": "D", "text": "Bronchial mucosal epithelial cell", "correct": false}], "correct_answer": "B. Type 2 alveolar cell", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Type 2 alveolar cell Respiratory distress syndrome (RDS) is a condition that affects premature infants and is caused by a deficiency or dysfunction of surfactant in the lungs. Surfactant is a complex mixture of lipids and proteins that are produced by type 2 alveolar cells in the lungs.</p>\n<p><strong>Highyeild:</strong></p><p>Surfactant deficiency is an important cause of infant respiratory distress syndrome (IRDS, also known as hyaline membrane disease), the serious pulmonary disease that develops in infants born before their surfactant system is functional. This surfactant layer plays an important role in maintaining alveolar structure by reducing surface tension Surface tension is inversely proportional to the surfactant concentration per unit area.</p>\n<p><strong>Extraedge:</strong></p><p>Typically, type 1 alveolar cells comprise the major gas exchange surface of the alveolus and are integral to the maintenance of the permeability barrier function of the alveolar membrane. type I cells are flat cells with large cytoplasmic extensions and are the primary lining cells of the alveoli, covering approximately 95% of the alveolar epithelial surface area. Type 2 pneumocytes are the progenitors of type 1 cells and Type II cells are important in alveolar repair as well as other lung cellular functions. One prime function of the type II cell is the production of surfactant and homeostasis.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "While a normal inspiration, the size of the thoracic cavity increases. According to Boyle's law true about normal inspiration is _____", "options": [{"label": "A", "text": "The pressure inside the thoracic cavity decreases", "correct": true}, {"label": "B", "text": "Pressure is increased inside the thoracic cavity", "correct": false}, {"label": "C", "text": "Diaphragm pushes up", "correct": false}, {"label": "D", "text": "All of the above", "correct": false}], "correct_answer": "A. The pressure inside the thoracic cavity decreases", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The pressure inside the thoracic cavity decreases According to Boyle's law, the pressure of a gas is inversely proportional to its volume. During normal inspiration, the size of the thoracic cavity increases, which results in a decrease in the pressure inside the thoracic cavity. Therefore, this is the correct statement.</p>\n<p><strong>Highyeild:</strong></p><p>In a normal inspiration the size of the thoracic cavity increases (since the diaphragm descends downwards and the walls of the thorax move outward and forward) and thus the pressure inside decreases.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- The pressure inside the thoracic cavity Decreases. The other options, B and C, are not correct for a normal inspiration. Option D is incorrect because only option A is correct.</p>\n<p><strong>Table:</strong></p><p>Lung and chest wall Because of historical\n reasons and small pressures, pulmonary pressures are always presented in cm\n H₂O. Elastic recoil Tendency for lungs to\n collapse inward and chest wall to spring outward. At FRC, airway and\n alveolar pressures equal atmospheric pressure (PB; called zero), and\n intrapleural pressure is negative (preventing atelectasis). The inward pull\n of the lung is balanced by the outward pull of the chest wall. System\n pressure is atmospheric. Pulmonary vascular resistance (PVR) is at a minimum Compliance Change in lung volume for\n a change in pressure (AV/AP). Inversely proportional to wall stiffness and\n increased by surfactant. ↑ compliance = lung easier\n to fill (eg, emphysema, older adults) + compliance = lung more\n difficult to fill (eg, pulmonary fibrosis, pneumonia, ARDS, pulmonary edema) Hysteresis Lung inflation follows a\n different pressure- volume curve than lung deflation due to need to overcome\n surface tension forces in inflation.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 15 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A 35-year-old individual met with a Road traffic accident, Local’s brought him to ER, he was confused and had significant heavy blood loss. Which of the following is a sign of hemorrhagic shock?", "options": [{"label": "A", "text": "Dry skin", "correct": false}, {"label": "B", "text": "Polyuria", "correct": false}, {"label": "C", "text": "Low hematocrit", "correct": true}, {"label": "D", "text": "Metabolic alkalosis", "correct": false}], "correct_answer": "C. Low hematocrit", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Low hematocrit The patient presented with hemorrhagic shock, loss of blood causes blood pressure to fall and Heart rate to increase.</p>\n<p><strong>Highyeild:</strong></p><p>The baroreceptor reflex response to the fall in blood pressure causes a reflex increase in sympathetic outflow, causing an alpha-adrenergic receptor-mediated increase in arteriolar resistance, which further decreases capillary perfusion pressure. Because whole blood is lost, the concentration of circulating proteins remains normal and, therefore, the oncotic pressure remains the same. The decreased capillary pressure and normal oncotic pressure result in the transfer of fluid from the interstitium to the vascular bed, decreasing the hematocrit .</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Option:- Option: A. Metabolic alkalosis: Trauma patients are more prone to acidosis. Option: B . Dry skin: Sympathetic stimulation causes peripheral constriction and produces sweating, resulting in the classic sign of hemorrhage: cold, damp skin. Option: C. Polyuria: Hypovolemia patients will have decreased urine output.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 72-year-old woman presents to her physician with dyspnea. Pulmonary function tests revealed an increase, rather than a decrease, in the diffusing capacity of the lung. Which of the following conditions best accounts for an increase in the diffusing capacity?", "options": [{"label": "A", "text": "Polycythemia", "correct": true}, {"label": "B", "text": "Fibrotic lung disease", "correct": false}, {"label": "C", "text": "Pulmonary embolism", "correct": false}, {"label": "D", "text": "Congestive heart failure", "correct": false}], "correct_answer": "A. Polycythemia", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Polycythemia Increases in the diffusing capacity can be produced by increasing the concentration of hemoglobin within the blood (polycythemia).</p>\n<p><strong>Highyeild:</strong></p><p>Diffusing capacity is measured by measuring the transfer of oxygen or carbon monoxide across the alveolar-capillary membrane. Because the partial pressure of oxygen and carbon monoxide is affected by their chemical reactions with hemoglobin, as well as their transfer through the membrane, the diffusing capacity of the lung is determined both by the diffusing capacity of the membrane itself, as well as by the reaction with hemoglobin. The diffusing capacity of the membrane can be calculated by rearranging Fick's law for diffusion and is related to the ratio of the surface area available for diffusion and the thickness of the alveolar-capillary interface.</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option: B. Fibrotic lung disease and Option D. Congestive heart failure : The of the diffusional barrier is increased by interstitial fibrosis and by interstitial or alveolar edema found in congestive heart failure. Option: C. Pulmonary embolism: The area available for diffusion is decreased by alveolar-septal departitioning in emphysema and by obstruction of the pulmonary vascular bed by pulmonary emboli.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A Young individual male lost consciousness in a car with a running engine where he had been waiting for a friend for a long time. What hemoglobin compound can be found in the blood of the patient?", "options": [{"label": "A", "text": "Oxyhemoglobin", "correct": false}, {"label": "B", "text": "Methemoglobin", "correct": false}, {"label": "C", "text": "Carboxyhemoglobin", "correct": true}, {"label": "D", "text": "Deoxyhemoglobin", "correct": false}], "correct_answer": "C. Carboxyhemoglobin", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Carboxyhemoglobin Car fumes contain carbon monoxide.</p>\n<p><strong>Highyeild:</strong></p><p>Hemoglobin has a much higher affinity for carbon monoxide (CO) than for O2. Consequently, CO displaces O2 and thus reduces the oxygen-carrying capacity of erythrocytes. Carbon monoxide and Hb form carbon monoxyhemoglobin also called carboxyhemoglobin . That compound is reversible, treatment is giving oxygen to a patient.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect options:- Option: A. Oxyhemoglobin, represents the fraction of oxygenated Hb with the total Hb present, including non-oxygen-binding hemoglobins. Option: B . Methemoglobin is a form of hemoglobin that has been oxidized, changing its heme iron configuration from the ferrous (Fe2+) to the ferric (Fe3+) state. Option: D. Deoxyhemoglobin, hemoglobin not combined with oxygen.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which type of hemoglobin is not normally found within human erythrocytes?", "options": [{"label": "A", "text": "НЬА", "correct": false}, {"label": "B", "text": "HbA2", "correct": false}, {"label": "C", "text": "HbCO", "correct": true}, {"label": "D", "text": "HbO2", "correct": false}], "correct_answer": "C. HbCO", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>HbCO HbCO hemoglobin is not normally found within human erythrocytes.</p>\n<p><strong>Highyeild:</strong></p><p>In normal adult human hemoglobin (hemoglobin A), the two polypeptides are called A chains, each of which contains 141 amino acid residues, and B chains, each of which contains 146 amino acid residues. About 2.5% of the hemoglobin is hemoglobin A2. Hemoglobin binds O2 to form oxyhemoglobin, O2 attaching to the Fe2+ in heme. Carboxyhemoglobin is a result of carbon monoxide poisoning which leads to decreased oxygen delivery to the tissues. Haemoglobin has 300 times more affinity towards carbon monoxide as compared to oxygen.</p>\n<p><strong>Random:</strong></p><p>Explanation for incorrect options: - Options A, B, and D are normally found in RBC.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 14 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A 52-year-old female comes for her annual physical examination. Upon auscultation, a third heart sound (S3) is heard. The differential diagnosis of this finding includes which of the following?", "options": [{"label": "A", "text": "Anemia", "correct": true}, {"label": "B", "text": "Bradycardia", "correct": false}, {"label": "C", "text": "Mitral stenosis", "correct": false}, {"label": "D", "text": "Aortic regurgitation", "correct": false}], "correct_answer": "A. Anemia", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Anemia The third heart sound (S3) is associated with rapid ventricular filling of the left ventricle. S3 is commonly heard in children and young adults and is also heard in conditions when the rapid filling of the ventricle is abnormally high, for example, in anemia or mitral regurgitation.</p>\n<p><strong>Highyeild:</strong></p><p>The third heart sound (S3) is a low-frequency/low-pitched, short vibration, it is produced due to the vibrations which set up in the ventricular wall due to the rushing of blood into the ventricles during a rapid filling phase. Clinical Significance of S3: Congestive heart failure is the most common cause of an S3. Any cause of a significant increase in the volume load on the ventricles) can cause an S3. Examples include valvular regurgitation, high-output states (anemia, pregnancy, arteriovenous fistula, or thyrotoxicosis), left-to-right intracardiac shunts, complete A-V block, renal failure, and volume overload from excessive fluids or blood transfusion. Any cause of ventricular dysfunction, including ischemic heart disease, dilated or hypertrophic cardiomyopathy, myocarditis, cor-pulmonale, or acute valvular regurgitation, may qualify. Myocardial ischemia without ventricular dysfunction or volume overload is not a cause of an S3.</p>\n<p><strong>Random:</strong></p><p>Explanation for incorrect options:- Option: B. Bradycardia, generally not associated with S3 Heart sound. Option: C. Mitral Regurgitation, present S3 heart sound not in Mitral stenosis. Option: D. Aortic Regurgitation, S4 present because Left atrial enlargement is there.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 47-year-old anephric patient revealed anemia symptoms. What is the cause of these symptoms?", "options": [{"label": "A", "text": "Iron deficiency", "correct": false}, {"label": "B", "text": "Vitamin B12 deficiency", "correct": false}, {"label": "C", "text": "Folic acid deficiency", "correct": false}, {"label": "D", "text": "Reduced synthesis of erythropoietins", "correct": true}], "correct_answer": "D. Reduced synthesis of erythropoietins", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Reduced synthesis of erythropoietins An anephric person doesn’t have a kidney, thus he will have anemia resulting from decreased EPO production.</p>\n<p><strong>Highyeild:</strong></p><p>The principal stimulus for red blood cell production is a circulating hormone called erythropoietin (EPO). In a normal person, about 90 percent of all erythropoietin is formed in the kidneys ; the remainder is formed mainly in the liver.</p>\n<p><strong>Random:</strong></p><p>Explanation for incorrect options:- Option: A. Iron deficiency anemia is due to lack of iron in the body. Option: B. Vitamin B12 can only be synthesized by microorganisms which in humans are localized in the colon where B12 cannot be taken up by the organism. Option: C. Folic acid is synthesized by bacteria from the substrate, para-amino-benzoic acid (PABA), and all cells require folic acid for growth.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A “Himalayan Yogi” permanently lives high in the mountains. What changes in blood characteristics can be found in this organism?", "options": [{"label": "A", "text": "Decrease in hemoglobin content", "correct": false}, {"label": "B", "text": "Decrease in reticulocytes number", "correct": false}, {"label": "C", "text": "Decrease of the color index of blood", "correct": false}, {"label": "D", "text": "Increase of erythrocytes number", "correct": true}], "correct_answer": "D. Increase of erythrocytes number", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Increase of erythrocytes number At high altitudes, the number of RBCs increases.</p>\n<p><strong>Highyeild:</strong></p><p>At very high altitudes , where the quantity of oxygen in the air is greatly decreased, insufficient oxygen is transported to the tissues, and red cell production is greatly increased. In this case, it is not the concentration of red blood cells in the blood that controls red cell production but the amount of oxygen transported to the tissues in relation to tissue demand for oxygen .</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. At high altitudes, the concentration of hemoglobin content Option: B . Being at high altitudes may cause reticulocyte counts to rise. Option: C . At high altitudes, the color index of blood increases, the color index of blood is the ratio of the percentage of hemoglobin (compared to \"normal\") to the red blood cell count.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 29-year-old man met with a road traffic accident and was brought to the hospital. While he was carried to the hospital via ambulance the paramedics started giving him fluids intravenously and unfortunately by mistake despite normal saline solution, they infused 1000 ml of distilled water. What should be the shape of the red blood cells of the patient and plasma osmolarity respectively?", "options": [{"label": "A", "text": "Swollen, hypoosmotic", "correct": true}, {"label": "B", "text": "Created, hyperosmotic", "correct": false}, {"label": "C", "text": "Swollen, hyperosmotic", "correct": false}, {"label": "D", "text": "Crenation Only", "correct": false}], "correct_answer": "A. Swollen, hypoosmotic", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Swollen, hypoosmotic As distilled water is given, the plasma osmolarity decreases. This leads to the movement of water inside the RBCs and makes them swollen.</p>\n<p><strong>Highyeild:</strong></p><p>Osmotic fragility Test:- Osmotic fragility is a test to measure red blood cell (RBC) resistance to hemolysis when exposed to a series of increasingly dilute saline solutions. The sooner hemolysis occurs, the greater the osmotic fragility of the cells.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Options: B & C. Addition of pure water to the isotonic solution (blood will dilute the solution and make it hypoosmotic, not hyperosmotic . So, incorrect options. Option: D. Bathing red blood cells in a hyper-osmotic solution will cause cell swelling and osmolysis, not creation, which is actually shriveling of cells . So, it is an incorrect</p>\n<p><strong>Extraedge:</strong></p><p>Clinical significance of Osmotic Fragility :- Osmotic fragility test assesses the integrity of the membrane of red cells. Increased Osmotic Fragility is seen in the following:- Cells which have a lower surface to volume ratio such as spherocytes from any cause have increased osmotic fragility is seen in the following Conditions:- Hereditary spherocytosis (HS) Autoimmune Hemolytic Anemias (A1HA) Hemolytic Disease of new bom Malaria Severe pyruvate kinase deficiency Other conditions in which spherocytes are found in the blood Conditions with decreased Osmotic Fragility:- Cells which have a high surface to volume ratio such as thin/hypochromic/target cells have decreased osmotic fragility. Thalassemia Other hemoglobinopathies eg. HbC, HbS Iron deficiency anemia Sickle cell anemia Post splenectomy Reticulocytosis Other conditions in which thin/target cells are found in the blood.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Death due to cyanide poisoning results from which of the following types of hypoxia?", "options": [{"label": "A", "text": "Hypoxic hypoxia", "correct": false}, {"label": "B", "text": "Anemic hypoxia", "correct": false}, {"label": "C", "text": "Stagnant hypoxia", "correct": false}, {"label": "D", "text": "Histotoxic hypoxia", "correct": true}], "correct_answer": "D. Histotoxic hypoxia", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Histotoxic hypoxia Cyanide poisoning causes histotoxic hypoxia because it blocks the mitochondria from consuming oxygen.</p>\n<p><strong>Highyeild:</strong></p><p>Cyanide Poisoning:- Exposure:- Synthetic product combustion, amygdalin ingestion (found in apricot seeds), cyanide ingestion (e.g., in suicide attempts), fire victims. Presentation : Headache, dyspnea, drowsiness, seizure, coma. May have cherry red skin. The breath may have a bitter almond odor. Labs Value : Normal Pao2 , Elevated lactate -> anion gap metabolic acidosis. Effect on oxygen hemoglobin curve:- Curve normal, oxygen saturation may appear normal initially. Despite ample O2 supply, it cannot be used due to ineffective oxidative phosphorylation. Treatment:- Decontamination, Sodium thiosulfate, nitrites, and hydroxocobalamin.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect options:- Option: A . Hypoxic Hypoxic hypoxia occurs when not enough oxygen is in the air or when decreasing atmospheric pressures prevent the diffusion of O2 from the lungs to the bloodstream. Option: B . Anemic hypoxia occurs when the oxygen-carrying ability of the blood decreases. Option: C . Stagnant hypoxia occurs when blood flow to the lung is abnormally low, such as during shock states, cardiac arrest, severe congestive heart failure, or abdominal compartment syndrome.</p>\n<p><strong>Extraedge:</strong></p><p>Hb CONCENTRATION Sao 2 Pao 2 TOTAL O 2 CONTENT CO poisoning Normal ↓ (CO competes with O₂) Normal ↓ Anemia ↓ Normal Normal ↓ Polycythemia ↑ Normal Normal ↑ Methemoglobinemia Normal ↓ (Fe3+ poor at binding O₁) Normal ↓ Cyanide toxicity Normal Normal Normal Normal</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 15 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "An 18-year-old college student living in a dormitory contracts meningitis, which causes a centrally mediated increase in his respiratory rate. The basic respiratory rhythm is generated in which of the following regions of the brain?", "options": [{"label": "A", "text": "Cerebral cortex", "correct": false}, {"label": "B", "text": "Hypothalamus", "correct": false}, {"label": "C", "text": "Reticular activating system", "correct": false}, {"label": "D", "text": "Medulla", "correct": true}], "correct_answer": "D. Medulla", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Medulla In the given scenario, the college student has contracted meningitis, which is causing a centrally mediated increase in his respiratory rate. This means that the increase in respiratory rate is being controlled by the respiratory control center in the brain, which is located in the medulla. Therefore, the correct answer is D. Medulla.</p>\n<p><strong>Highyeild:</strong></p><p>The basic respiratory rhythm is generated in the medulla of the brain. The medulla contains several groups of neurons that form the respiratory control center, which includes the dorsal respiratory group (DRG) and the ventral respiratory group (VRG). These groups of neurons work together to control the rate and depth of breathing. The medulla has the respiratory rhythmic center. The pons have collections of neurons known as the pneumotaxic center and apneustic center.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- The basic respiratory rhythm is initiated by a small group of synaptically coupled pacemaker cells in the pre-Bötzinger complex on either side of the medulla between the nucleus ambiguus and the lateral reticular nucleus. This basic rhythm can be modified by many factors, including higher centers in the cerebral cortex and hypothalamus and input from the reticular activating system and pontine respiratory centers, including the pneumotaxic center in the nucleus para-brachialis.</p>\n<p><strong>Extraedge:</strong></p><p>RESPIRATORY CONTROL SYSTEM OF THE BRAIN Respiration is controlled by two separate neural mechanisms. One voluntary and one involuntary. Nerves from the cerebral cortex communicate with the motor neurons that directly innervate the diaphragm and the other respiratory muscles. This is responsible for the voluntary component. Other areas of the brain-classically referred to as the respiratory centers located in the medulla and pons are responsible for the involuntary or automatic component. They, too, communicate with the motor neurons supplying the respiratory muscles. This center has two groups of neurons. One group is situated dorsally—the dorsal respiratory group— and contains neurons that control the motor neurons that supply the diaphragm and the external intercostal muscles. Another group of neurons in the medulla, situated ventrally, the ventral respiratory group, is active during forced respiration.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 5-month-old boy is admitted to the hospital for evaluation because of repeated episodes of sleep apnea. During a ventilatory response test, his ventilation did not increase when PaCO2 was increased but decreased during hyperoxia. Which of the following is the most likely cause of this infant’s apnea?", "options": [{"label": "A", "text": "Bronchospasm", "correct": false}, {"label": "B", "text": "Diaphragmatic fatigue", "correct": false}, {"label": "C", "text": "Decreased irritant receptor sensitivity", "correct": false}, {"label": "D", "text": "Dysfunctional central chemoreceptors", "correct": true}], "correct_answer": "D. Dysfunctional central chemoreceptors", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Dysfunctional central chemoreceptors The most likely cause of the infant's apnea in this scenario is dysfunctional central chemoreceptors. The central chemoreceptors are responsible for detecting changes in PaCO2 levels and are essential for regulating ventilation. In this case, the infant's ventilation did not increase when PaCO2 was increased, indicating that the central chemoreceptors were not responding appropriately.</p>\n<p><strong>Highyeild:</strong></p><p>The central chemoreceptors respond to changes in [H+] in the cerebrospinal fluid (CSF), which are brought about by changes in arterial PCO2. The failure of CO2 to increase ventilation indicates that the central chemoreceptors are not functioning properly. The peripheral chemoreceptors are stimulated by hypoxia, hypercapnia, and acidemia, and thus are functioning appropriately because ventilation decreased when PO2 was increased (hyperoxia).</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A . Bronchospasm: Obstructive sleep apnea is caused by upper airway obstruction due to hypotonic pharyngeal or genioglossus muscles or too much fat around the pharynx, but not because of obstruction of the tracheobronchial tree by bronchospasm. Option B. Diaphragmatic fatigue: Diaphragmatic fatigue can cause hypoventilation, but is not associated with apneic episodes, perhaps because of the increased contribution of the accessory muscles of respiration. Option C. Decreased irritant receptor sensitivity: The reflex effect of stimulation of the irritant receptors by mechanical or chemical irritation of the airways is bronchoconstriction and cough.</p>\n<p><strong>Table:</strong></p><p>Receptors: Aortic arch\ntransmits via vagus nerve to solitary nucleus of medulla (responds to changes\nin BP). Carotid\nsinus (dilated region superior to bifurcation of carotid arteries) transmits\nvia glossopharyngeal nerve to solitary nucleus of medulla (responds to changes\nin BP). Chemoreceptors: • Peripheral-carotid\nand aortic bodies are stimulated by ↑ PCO2, ↓\npH of blood, and ↓ Po₂ (<60 mm Hg). •\nCentral-are stimulated by changes in pH and Pco₂ of brain interstitial fluid,\nwhich in turn are influenced by arterial CO2 as H* cannot cross the blood-brain\nbarrier. Do not directly respond to Poz. Central chemoreceptors become less\nresponsive with chronically ↑ PCO₂ (eg, COPD) → ↑ dependence on peripheral\nchemoreceptors to detect ↓ O₂ to drive respiration. Baroreceptors: • Hypotension-arterial pressure→↓ stretch →↓ afferent baroreceptor firing → ↑\nefferent sympathetic firing and efferent parasympathetic stimulation →\nvasoconstriction, ↑ HR, ↑ contractility, ↑ BP. Important in the response to\nhypovolemic shock. • Carotid\nmassage-t carotid sinus pressure → ↑ afferent baroreceptor firing→ ↑ AV node\nrefractory period→ HR →↓ CO. Also leads to peripheral vasodilation. Can cause\npresyncope/syncope. Exaggerated in underlying atherosclerosis, prior neck\nsurgery, older age. • Component\nof Cushing reflex (triad of hypertension, bradycardia, and respiratory\ndepression)—† intracranial pressure constricts arterioles → cerebral ischemia →\n↑ PCO₂ and pH → central reflex sympathetic ↑ in perfusion pressure\n(hypertension) ↑ stretch → peripheral reflex baroreceptor- induced bradycardia.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Central chemoreceptors are most sensitive to:", "options": [{"label": "A", "text": "Increase in CO2 Tension", "correct": true}, {"label": "B", "text": "Decrease in CO2 Tension", "correct": false}, {"label": "C", "text": "Low O2 Tension", "correct": false}, {"label": "D", "text": "Increase in H+", "correct": false}], "correct_answer": "A. Increase in CO2 Tension", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Increase in CO2 Tension Central chemoreceptors are most sensitive to an increase in CO2 tension (PaCO2) in the cerebrospinal fluid. When CO2 levels increase, carbonic anhydrase in the brain catalyzes the formation of H+ ions, which in turn stimulate the central chemoreceptors. Therefore, option A, an increase in CO2 tension, is the correct answer.</p>\n<p><strong>Highyeild:</strong></p><p>The central chemoreceptors are located in the medulla oblongata, near the respiratory centers. They are highly sensitive to changes in CO2 levels in the CSF, but they also respond to changes in blood pH levels , which are influenced by CO2 levels in the blood. The chemoreceptors monitor the H+ concentration of cerebrospinal fluid (CSF) , including the brain interstitial fluid. CO2 readily penetrates membranes, including the blood-brain barrier, whereas H+ and HCO3–penetrate slowly.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "All of the following are related to oxygen toxicity except:", "options": [{"label": "A", "text": "Retinal blindness", "correct": false}, {"label": "B", "text": "Pulmonary edema", "correct": false}, {"label": "C", "text": "Decreased cerebral blood flow", "correct": true}, {"label": "D", "text": "Convulsions", "correct": false}], "correct_answer": "C. Decreased cerebral blood flow", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Decreased cerebral blood flow Decreased cerebral blood flow is not typically associated with oxygen toxicity. In fact, oxygen therapy is often used to increase cerebral blood flow in certain medical conditions. Decreased cerebral blood flow is seen with high oxygen tension . But it is a protective effect caused by cerebral vasoconstriction.</p>\n<p><strong>Highyeild:</strong></p><p>Retinal blindness can occur due to damage to the retina caused by oxygen toxicity. Pulmonary edema can develop due to damage to the alveolar-capillary membrane in the lungs. Convulsions can result from the oxidative stress caused by oxygen toxicity in the central nervous system.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Pulmonary effects are more common Smith effect. Manifestations are pulmonary edema, atelectasis, and congestion of lung passages. Retrolental fibroplasia (retinopathy of prematurity) is seen following the administration of a high concentration of oxygen to neonates. It can lead to blindness. It is caused by It mostly affects the CNS – Bert effect. It is characterized by muscle twitching, convulsions, and coma.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Most important stimulus to peripheral chemoreceptors?", "options": [{"label": "A", "text": "PO2", "correct": true}, {"label": "B", "text": "CO2", "correct": false}, {"label": "C", "text": "pH", "correct": false}, {"label": "D", "text": "HCO3", "correct": false}], "correct_answer": "A. PO2", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>PO2 The most important stimulus to peripheral chemoreceptors is a decrease in PO2 (partial pressure of oxygen). Peripheral chemoreceptors are specialized cells located in the carotid and aortic bodies that detect changes in blood chemistry and send signals to the respiratory centers in the brainstem, which in turn regulate breathing.</p>\n<p><strong>Highyeild:</strong></p><p>Peripheral chemoreceptors are specialized cells located in the carotid and aortic bodies that detect changes in blood chemistry and send signals to the respiratory centers in the brainstem, which in turn regulate breathing. These receptors are highly sensitive to a decrease in the PO2 levels of arterial blood, which is the primary stimulus for their activation.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- CO2, pH, and HCO3 levels can also influence the activity of peripheral chemoreceptors, their effect is secondary to that of PO2.</p>\n<p><strong>Table:</strong></p><p>Receptors: Aortic arch\ntransmits via vagus nerve to solitary nucleus of medulla (responds to changes\nin BP). Carotid\nsinus (dilated region superior to bifurcation of carotid arteries) transmits\nvia glossopharyngeal nerve to solitary nucleus of medulla (responds to changes\nin BP). Chemoreceptors: • Peripheral-carotid\nand aortic bodies are stimulated by ↑ PCO2, ↓\npH of blood, and ↓ Po₂ (<60 mm Hg). •\nCentral-are stimulated by changes in pH and Pco₂ of brain interstitial fluid,\nwhich in turn are influenced by arterial CO2 as H* cannot cross the blood-brain\nbarrier. Do not directly respond to Poz. Central chemoreceptors become less\nresponsive with chronically ↑ PCO₂ (eg, COPD) → ↑ dependence on peripheral\nchemoreceptors to detect ↓ O₂ to drive respiration. Baroreceptors: • Hypotension-arterial pressure→↓ stretch →↓ afferent baroreceptor firing → ↑\nefferent sympathetic firing and efferent parasympathetic stimulation →\nvasoconstriction, ↑ HR, ↑ contractility, ↑ BP. Important in the response to\nhypovolemic shock. • Carotid\nmassage-t carotid sinus pressure → ↑ afferent baroreceptor firing→ ↑ AV node\nrefractory period→ HR →↓ CO. Also leads to peripheral vasodilation. Can cause\npresyncope/syncope. Exaggerated in underlying atherosclerosis, prior neck\nsurgery, older age. • Component\nof Cushing reflex (triad of hypertension, bradycardia, and respiratory\ndepression)—† intracranial pressure constricts arterioles → cerebral ischemia →\n↑ PCO₂ and pH → central reflex sympathetic ↑ in perfusion pressure\n(hypertension) ↑ stretch → peripheral reflex baroreceptor- induced bradycardia.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 15 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "Each of the images in the diagram below illustrates a train of action potentials in response to a sudden limb movement. The sensory neuron encoding the velocity of the limb movement is illustrated by which of the following image?", "options": [{"label": "A", "text": "A", "correct": false}, {"label": "B", "text": "B", "correct": true}, {"label": "C", "text": "C", "correct": false}, {"label": "D", "text": "D", "correct": false}], "correct_answer": "B. B", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>B The IA afferents, which innervate the muscle spindles, have a phasic and tonic component . B illustrates the response of IA afferents to a sudden movement of a limb.</p>\n<p><strong>Highyeild:</strong></p><p>The high-frequency burst of action potentials encodes the velocity of the initial movement, whereas the steady firing encodes the position of the limb when the movement is completed.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Statements A and E: Illustrate the behavior of a tonic receptor, which discharges at the same rate for as long as the stimulus is present. Statement C: Shows a fast adapting phasic receptor which increases firing upon application of a For example: Olfactory receptors</p>\n<p><strong>Extraedge:</strong></p><p>Explanation for Incorrect Options:- Statements A and E: Illustrate the behavior of a tonic receptor, which discharges at the same rate for as long as the stimulus is present. Statement C: Shows a fast adapting phasic receptor which increases firing upon application of a For example: Olfactory receptors</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 34-year-old woman, who has been immobilized with a sprained ankle for the past 4 days, develops a throbbing pain that has spread to her entire left leg. History reveals that she has been taking oral contraceptives for 15 years. Compared to localized pain, such as one might experience from a needle stick, which of the following is true of ischemic pain?", "options": [{"label": "A", "text": "Ischemic pain sensory fibers are classified as A-delta (Ad) sensory fibers", "correct": false}, {"label": "B", "text": "Ischemic pain is produced by overstimulating somatic touch receptors", "correct": false}, {"label": "C", "text": "Ischemic pain is transmitted to the brain through the Neo spinothalamic tract", "correct": false}, {"label": "D", "text": "Ischemic pain sensory fibers terminate within the substantia gelatinosa of the spinal cord", "correct": true}], "correct_answer": "D. Ischemic pain sensory fibers terminate within the substantia gelatinosa of the spinal cord", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Ischemic pain sensory fibers terminate within the substantia gelatinosa of the spinal cord This is a case of Deep Vein Thrombosis (given the risk factors of immobilization and history of Oral contraceptives ). Activating nociceptors on the free nerve endings of C fibers produces ischemic Pain</p>\n<p><strong>Highyeild:</strong></p><p>The C fibers synapse on interneurons located within the substantia gelatinosa (laminas II and III) of the dorsal horn of the spinal cord. The pathway conveying ischemic pain to the brain is called the paleospinothalamic system. In contrast, well-localized pain sensations are carried within the Neo spinothalamic tract. Ischemic pain does not adapt to prolonged stimulation.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. A-delta nerve fibers: These fibers transmit “first-pain” signals, the pricking, sharp sensations felt immediately after a stimulus. Option: B. Sensory signals triggering chest pain during myocardial ischemia are conveyed by thinly myelinated Aδ- and unmyelinated C-fibers that travel in cardiac spinal afferents. Option: C. A pain message is transmitted to the brain by specialized nerve cells known as nociceptors, or pain receptors, Activation of nociceptors is transduced along the axons of peripheral nerves which terminate in the dorsal horn of the spine.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 10-year-old girl with Type I diabetes develops a neuropathy limited to sensory neurons with free nerve endings. Quantitative sensory testing will reveal higher-than-normal thresholds for the detection of which of the following?", "options": [{"label": "A", "text": "Fine touch", "correct": false}, {"label": "B", "text": "Vibration", "correct": false}, {"label": "C", "text": "Pressure", "correct": false}, {"label": "D", "text": "Temperature", "correct": true}], "correct_answer": "D. Temperature", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Temperature Quantitative sensory testing will show higher-than-normal thresholds for the detection of Temperature. Quantitative Sensory Testing (often called 'QST') allows us to measure changes in sensitivity to different types of sensations that can include temperature, touch , or pressure</p>\n<p><strong>Highyeild:</strong></p><p>Free nerve endings contain receptors for temperature, pain, and crude touch. However, fine touch, pressure, and vibration are detected by nerve endings contained within specialized capsules that transmit the stimulus to the sensory receptors. Muscle length is encoded by the primary nerve endings of Ia fibers, which are located on intrafusal fibers within the muscle spindle. There are four types of diabetic neuropathy: Peripheral neuropathy (also called diabetic nerve pain and distal polyneuropathy) Proximal neuropathy (also called diabetic amyotrophy) Autonomic neuropathy Focal neuropathy (also called mononeuropathy) Peripheral neuropathy is nerve damage caused by chronically high blood sugar and diabetes. It leads to numbness, loss of sensation, and sometimes pain in your feet, legs, or hands. It is the most common complication of diabetes Peripheral neuropathy is nerve damage caused by chronically high blood sugar and diabetes. It leads to numbness, loss of sensation, and sometimes pain in your feet, legs, or hands. It is the most common complication of diabetes.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Quantitative Sensory Testing allows measuring changes in sensitivity to different types of sensations that can include temperature , touch, or pressure but in the case of temperature, it will show more than normal.</p>\n<p><strong>Extraedge:</strong></p><p>Types of peripheral neuropathy Sensory i.e. diabetic neuropathy Motor i.e. Guillain-Barré Autonomic i.e. Dysautonomia, diabetic autonomic neuropathy Combined Most peripheral neuropathies</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "At which location along the basilar membrane are the highest-frequency sounds detected?", "options": [{"label": "A", "text": "Nearest the oval window", "correct": true}, {"label": "B", "text": "Farthest from the oval window, near the helicotrema", "correct": false}, {"label": "C", "text": "Uniformly along the basilar membrane", "correct": false}, {"label": "D", "text": "At the midpoint of the membrane", "correct": false}], "correct_answer": "A. Nearest the oval window", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Nearest the oval window The feature of the traveling wave is that it travels fast along the initial portion of the basilar membrane but becomes progressively slower as it goes farther into the cochlea .</p>\n<p><strong>Highyeild:</strong></p><p>The cause of this difference is the high coefficient of elasticity of the basilar fibers near the oval window and a progressively decreasing coefficient farther along the membrane. This rapid initial transmission of the wave allows the high-frequency sounds to travel far enough into the cochlea to spread out and separate from one another on the basilar membrane. Without this rapid initial transmission, all the high-frequency waves would be bunched together within the first millimeter or so of the basilar membrane, and their frequencies could not be discriminated against.</p>\n<p><strong>Extraedge:</strong></p><p>The portion of the basilar membrane vibrated by a sound depends on the frequency of the sound. High-frequency sounds produce a vibration of the basilar membrane at the base of the cochlea (near the oval and round windows); low-frequency sounds produce a vibration of the basilar membrane at the apex of the cochlea (near the helicotrema) The modiolus is the bony center of the cochlea from which the basilar membrane emerges, the spiral ganglion contains the cell bodies of the auditory nerve fibers, and the stria vascularis is the vascular bed located on the outer wall of the scala media of the cochlea responsible for endolymph secretion.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The brown-sequard syndrome is characterized by:", "options": [{"label": "A", "text": "Fine touch lost on the opposite side", "correct": false}, {"label": "B", "text": "Pain and temperature loss on the same side", "correct": false}, {"label": "C", "text": "Pain and temperature loss on the opposite side", "correct": true}, {"label": "D", "text": "Only pain lost on the same side", "correct": false}], "correct_answer": "C. Pain and temperature loss on the opposite side", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Pain and temperature loss on the opposite side A functional hemisection of the spinal cord causes a characteristic and easily recognized clinical picture that reflects damage to ascending sensory ( dorsal column pathway, ventrolateral spinothalamic tract) and descending motor ( corticospinal tract) pathways, which is called the Brown-Séquard syndrome.</p>\n<p><strong>Highyeild:</strong></p><p>Ipsilateral loss of discriminative touch, vibration, and proprioception below the level of the lesion: lesion to fasciculus gracilis or fasciculus cuneatus Contralateral loss of pain and temperature sensation beginning one or two segments below the lesion: due to loss of the spinothalamic tract. Ipsilateral loss of motor function: Damage to the corticospinal tract produces a lower motor-type lesion at the level of hemisection. Upper motor type lesion (weakness and spasticity) at the level of hemisection. Although a precise spinal hemisection is rare, the syndrome is common because it can be caused by a spinal cord tumor, spinal cord trauma, degenerative disk disease, and ischemia.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest options are inappropriate because pain and temperature loss is on the opposite side of Brown-Séquard syndrome.</p>\n<p><strong>Extraedge:</strong></p><p>The Brown-Séquard syndrome is a neurologic syndrome resulting from hemisection of the spinal cord. It manifests with weakness or paralysis and proprioceptive deficits on the side of the body ipsilateral to the lesion and loss of pain and temperature sensation on the contralateral side.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Due to a central cord lesion, the dissociated sensory loss is seen due to:", "options": [{"label": "A", "text": "Decussating branches of lateral spinothalamic tract", "correct": true}, {"label": "B", "text": "Dorsal column", "correct": false}, {"label": "C", "text": "Anterior spinothalamic tract", "correct": false}, {"label": "D", "text": "Cilioretinal pathway", "correct": false}], "correct_answer": "A. Decussating branches of lateral spinothalamic tract", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Decussating branches of lateral spinothalamic tract Patients with this condition demonstrate a wide variety of neurological symptoms depending on where exactly the syrinx is located, but classically patients present with: A cape -like loss of pain and temperature sensation along the back and arms, known as a ‘suspended sensory level’ disproportionately greater bilateral motor impairment in the upper compared to lower extremities . This motor and sensory impairment can eventually cause atrophy, which begins in the hands and progresses proximally , resulting in deformities such as 'claw hands' and Charcot’s arthropathy</p>\n<p><strong>Highyeild:</strong></p><p>In central cord lesions such as Syringomyelia: The lesion to fasciculus gracilis or fasciculus cuneatus leads to ipsilateral loss of discriminative touch, vibration, and proprioception below the level of the The loss of the spinothalamic tract leads to contralateral loss of pain and temperature sensation beginning one or two segments below the lesion. Syringomyelia refers to a cystic collection, or syrinx, that occurs within the spinal cord around the central canal.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B: Dorsal column pathway: Fibers mediating these sensations ascend ipsilaterally in the dorsal columns of the spinal cord to the medulla, where they synapse in the gracilis and cuneate nuclei. The second-order neurons from these nuclei cross the midline and ascend in the medial lemniscus to end in the contralateral ventral posterior lateral (VPL) nucleus. This ascending system is called the dorsal column or medial lemniscal system. The fibers within the dorsal column pathway are joined in the brainstem by fibers. Option: C. The anterior spinothalamic tract carries sensory information regarding light, poorly localized touch. This information is carried in slow-conducting fibers (Aδ and C fibers) in contrast to the rapidly conducting fibers carrying information about pain and temperature. Option: D. No meaning of this Option, Cilioretinal pathway.</p>\n<p><strong>Extraedge:</strong></p><p>Ventral spinothalamic tract: Fibers from nociceptors and thermoreceptors synapse on neurons in the dorsal horn of the spinal cord. The axons from these dorsal horn neurons cross the midline and ascend in the ventrolateral quadrant of the spinal cord, where they form the ventrolateral spinothalamic pathway. Fibers within this tract synapse in the VPL. Some dorsal horn neurons that receive nociceptive input synapse in the reticular formation of the brainstem (spinoreticular pathway) and then project to the contralateral nucleus of the thalamus.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The distance by which two touch stimuli must be separated to be perceived as two separate stimuli is the greatest at?", "options": [{"label": "A", "text": "The lips", "correct": true}, {"label": "B", "text": "The palm of the hand", "correct": false}, {"label": "C", "text": "The back of the scapula", "correct": false}, {"label": "D", "text": "The dorsum of the hand", "correct": false}], "correct_answer": "A. The lips", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The lips The distance by which two touch stimuli must be separated to be perceived as two separate stimuli is greatest at the lips rather than the fingertips . Areas with maximum Two Point Discrimination ability are - Lips, Fingers</p>\n<p><strong>Highyeild:</strong></p><p>The two-point discrimination threshold is a measure of tactile acuity. The magnitude of two-point discrimination thresholds varies from place to place on the body and is the smallest where touch receptors are most abundant. Stimulus points on the back, for instance, must be separated by at least 65 mm before they can be distinguished as separate, whereas on the fingertips two stimuli are recognized if they are separated by as little as 2 mm. Two-point discrimination test (2PD) represents a large sensor fiber, which is more sensitive than a smaller fiber to detect abnormality in carpal tunnel syndrome (CTS).</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options: Option C . Areas with less Two Point Discrimination ability are - Back, Legs, Option B & D. Has less Two Point Discrimination ability as compared to Fingertips and lips.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following is true regarding triple response?", "options": [{"label": "A", "text": "Axon reflex", "correct": false}, {"label": "B", "text": "Flare is due to arteriolar dilation", "correct": false}, {"label": "C", "text": "Both", "correct": true}, {"label": "D", "text": "None", "correct": false}], "correct_answer": "C. Both", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Both The triple response consists of three aspects: Red spot , caused by capillary vasodilation . Flare is a redness in the surrounding area due to arteriolar dilation mediated by axon reflex. Wheal is caused by the exudation of extracellular fluid from capillaries and venules .</p>\n<p><strong>Highyeild:</strong></p><p>When the skin is stroked more firmly with a pointed instrument, instead of the white reaction there is reddening at the site that appears in about 10 s (red reaction). This is followed in a few minutes by local swelling and diffuse, mottled reddening around the injury. The initial redness is due to capillary dilation, a direct response of the capillaries to pressure. The swelling (wheal) is local edema due to increased permeability of the capillaries and postcapillary venules, with consequent extravasation of fluid. The redness spreading out from the injury (flare) is due to arteriolar dilation. This three-part response—the red reaction, wheal, and flare—is called the triple response and is part of the normal reaction to injury. It persists after total sympathectomy. On the other hand, the flare is absent in locally anesthetized skin and denervated skin after the sensory nerves have degenerated, but it is present immediately after a nerve block or section above the site of the injury. This, plus other evidence, indicates that it is due to an axon reflex, a response in which impulses initiated in sensory nerves by the injury are relayed antidromically down other branches of the sensory nerve fibers.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- The triple response consists of three aspects: Flare is due to arteriolar dilation , Axon reflex , and Wheal, caused by the exudation of extracellular fluid.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "In Brown-Séquard’s syndrome, there is:", "options": [{"label": "A", "text": "Ipsilateral loss of pain sensation", "correct": false}, {"label": "B", "text": "Ipsilateral loss of temperature sensation", "correct": false}, {"label": "C", "text": "Ipsilateral loss of proprioception", "correct": true}, {"label": "D", "text": "Ipsilateral loss of crude touch sensation", "correct": false}], "correct_answer": "C. Ipsilateral loss of proprioception", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Ipsilateral loss of proprioception A functional hemisection of the spinal cord causes a characteristic and easily recognized clinical picture that reflects damage to ascending sensory (dorsal column pathway, ventrolateral spinothalamic tract) and descending motor (corticospinal tract) pathways, which is called the Brown-Séquard syndrome.</p>\n<p><strong>Highyeild:</strong></p><p>Ipsilateral loss of discriminative touch, vibration, and proprioception below the level of the lesion: lesion to fasciculus gracilis or fasciculus cuneatus Contralateral loss of pain and temperature sensation beginning one or two segments below the lesion: due to loss of the spinothalamic tract. Ipsilateral loss of motor function: Damage to the corticospinal tract produces Lower motor-type lesions at the level of hemisection. Upper motor type lesion (weakness and spasticity) at the level of hemisection. Although a precise spinal hemisection is rare, the syndrome is common because it can be caused by a spinal cord tumor, spinal cord trauma, degenerative disk disease, and ischemia.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 19 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A neurologist strikes the tendons of various muscles to check the stretch reflex in a patient of stroke, the receptor involved is primarily regulating:", "options": [{"label": "A", "text": "Length", "correct": true}, {"label": "B", "text": "Stretch", "correct": false}, {"label": "C", "text": "Touch", "correct": false}, {"label": "D", "text": "Temperature", "correct": false}], "correct_answer": "A. Length", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Length When a skeletal muscle with an intact nerve supply is stretched, it contracts. This response is called the stretch reflex or myotatic reflex. The stimulus that initiates this reflex is the stretch of the muscle, and the response is the contraction of the muscle being stretched. The sense organ is a small encapsulated spindle-like or a fusiform-shaped structure called the muscle spindle, located within the fleshy part of the muscle . The impulses originating from the spindle are transmitted to the CNS by fast sensory fibers that pass directly to the motor neurons that supply the same muscle. The neurotransmitter at the central synapse is glutamate. This sense organ is involved in signaling changes in the length of the muscle in which it is located. Changes in muscle length are associated with changes in joint angle; thus, muscle spindles provide information on position (i.e., proprioception).</p>\n<p><strong>Highyeild:</strong></p><p>The muscle jerks are used by neurologists to assess the degree of facilitation of spinal cord centers. When large numbers of facilitatory impulses are being transmitted from the upper regions of the central nervous system into the cord, the muscle jerks are greatly exaggerated. Conversely, if the facilitatory impulses are depressed or abrogated, the muscle jerks are considerably weakened or absent. These reflexes are used most frequently in determining the presence or absence of muscle spasticity caused by lesions in the motor areas of the brain or diseases that excite the bulboreticular facilitatory area of the brain stem. Ordinarily, large lesions in the motor areas of the cerebral cortex but not in the lower motor control areas (especially lesions caused by strokes or brain tumors) cause greatly exaggerated muscle jerks in the muscles on the opposite side of the body.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. Stretch, is closely related to option A and may seem like a plausible answer, but the correct answer is A, length, as stretch refers to the physical act of stretching, while length refers to the measurement of the distance of the muscle . Option C. Touch, and Option D, temperature, are not related to the stretch reflex or the receptor involved in regulating it. Touch receptors detect tactile stimuli , while temperature receptors detect changes in temperature .</p>\n<p><strong>Extraedge:</strong></p><p>In a neurologic examination, Deep tendon reflexes are graded on the following scale: (0): absent (1+): hypoactive (2+): brisk, normal (3+): hyperactive without clonus (4+): hyperactive with mild clonus (5+): hyperactive with sustained clonus Root values of common reflexes Biceps: C5, C6 spinal nerve Triceps: C7 spinal nerve Knee jerk: L4 spinal nerve Ankle jerk: S1 spinal nerve</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 5-year-old boy presents with abnormal running, jumping, and hopping. His parents have observed that he uses his arms to climb up his legs when rising from the floor. The pediatrician suspects Duchenne muscular dystrophy, and electromyography confirms a myopathy. The amount of force produced by a skeletal muscle can be increased by which of the following?", "options": [{"label": "A", "text": "Increasing extracellular Mg2+", "correct": false}, {"label": "B", "text": "Decreasing extracellular Ca2+", "correct": false}, {"label": "C", "text": "Increasing the activity of acetylcholinesterase", "correct": false}, {"label": "D", "text": "Decreasing the interval between contractions", "correct": true}], "correct_answer": "D. Decreasing the interval between contractions", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Decreasing the interval between contractions When the interval between skeletal muscle contractions is small, the force produced by the two successive contractions will summate.</p>\n<p><strong>Highyeild:</strong></p><p>The shorter the interval between the contractions, the greater the summation will be. Maximum summation is called tetanus. Summation of contractions: The muscle fiber is electrically refractory only during the rising phase and part of the falling phase of the spike potential. At this time, the contraction initiated by the first stimulus is just beginning. However, because the contractile mechanism does not have a refractory period, repeated stimulation before relaxation has occurred produces additional activation of the contractile elements and a response that is added to the contraction already present. This phenomenon is known as the summation of contractions. The tension developed during summation is considerably greater than that during the single muscle twitch. With rapidly repeated stimulation, activation of the contractile mechanism occurs repeatedly before any relaxation has occurred, and the individual responses fuse into one continuous contraction. Such a response is called tetanus (tetanic contraction). It is complete tetanus when no relaxation occurs between stimuli and incomplete tetanus when periods of incomplete relaxation take place between the summated stimuli. During complete tetanus, the tension developed is about four times that developed by the individual twitch contractions.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Increasing extracellular Mg2+: Increasing the Mg2+ concentration will decrease skeletal muscle excitability. Option B. Decreasing extracellular Ca2+: Decreasing extracellular Ca2+ will increase the excitability of skeletal muscle fibers but does not have a direct effect on contractile force. Option C. Increasing the activity of acetylcholinesterase: Increasing the activity of acetylcholinesterase enhances the hydrolysis of acetylcholine and therefore decreases the likelihood that muscle contraction will be initiated.</p>\n<p><strong>Extraedge:</strong></p><p>Increasing the preload beyond 2.2 mm decreases the overlap between thick and thin filaments and therefore decreases the force of contraction.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 12-year-old male with muscular dystrophy is found to have a mutation of the gene that encodes the protein dystrophin. Genetic alterations in dystrophin lead to progressive muscular weakness because dystrophin provides structural support to the sarcolemma by binding which of the following?", "options": [{"label": "A", "text": "β-Dystroglycan to laminin", "correct": false}, {"label": "B", "text": "Actin to β-dystroglycan", "correct": true}, {"label": "C", "text": "Actin to the Z lines", "correct": false}, {"label": "D", "text": "Z lines to M lines", "correct": false}], "correct_answer": "B. Actin to β-dystroglycan", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Actin to β-dystroglycan The large dystrophin protein forms a rod that connects the thin actin filaments to the transmembrane protein β-dystroglycan in the sarcolemma by smaller proteins in the cytoplasm, syntrophins.</p>\n<p><strong>Highyeild:</strong></p><p>β-Dystroglycan is connected to merosin (merosin refers to laminins that contain the α2 subunit in their trimeric makeup) in the extracellular matrix by α-dystroglycan (Figure 5–3). The dystroglycan is in turn associated with a complex of four transmembrane glycoproteins: α-, β-, γ-, and δ-sarcoglycan. This dystrophin-glycoprotein complex adds strength to the muscle by providing scaffolding for the fibrils and connecting them to the extracellular environment.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. Actin to β-dystroglycan , is incorrect because actin is a cytoskeletal protein , not an extracellular matrix protein , and it is not directly involved in binding to dystrophin . Option C. Actin to the Z lines, is also incorrect because dystrophin does not directly bind to actin or the Z lines. Option D. Z lines to M lines, is also incorrect because this is a different structural component of muscle fibers that is not directly involved in the binding of dystrophin .</p>\n<p><strong>Extraedge:</strong></p><p>Duchenne muscular dystrophy is a serious form of dystrophy in which the dystrophin protein is absent from the It is X-linked and usually fatal by the age of 30. In Becker muscular dystrophy dystrophin is present but altered or reduced in amount. Limb-girdle muscular dystrophies of various types are associated with mutations of the genes coding for the sarcoglycans or other components of the dystrophin-glycoprotein complex. Due to its enormous size and structural role in the sarcomere, titin is a prominent target for mutations that give rise to muscle disease. Mutations that encode for shorter titin structures have been associated with dilated cardiomyopathy, while other mutations have been associated with hypertrophic cardiomyopathy. Skeletal muscle-associated tibial muscular dystrophy is a genetic muscle disease of titin that is predicted to destabilize the folded state of the protein.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "In the department of Physiology of a medical college, an experiment was conducted. In which a muscle was extracted and suspended in a physiological solution. The muscle taken does not contract spontaneously. But when directly stimulated by an electrode the muscle contracts. The muscle also continues to contract upon stimulation after being treated by a drug that antagonizes myosin light chain kinase activity. Based on the data provided, what type of muscle tissue was being tested in the experiment?", "options": [{"label": "A", "text": "Cardiac muscle", "correct": false}, {"label": "B", "text": "Skeletal muscle", "correct": true}, {"label": "C", "text": "Multiunit smooth muscle", "correct": false}, {"label": "D", "text": "Both A and B", "correct": false}], "correct_answer": "B. Skeletal muscle", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Skeletal muscle Skeletal muscles contract after stimulation. So the correct answer is B as other options are ruled out.</p>\n<p><strong>Highyeild:</strong></p><p>A skeletal muscle fiber is surrounded by a plasma membrane called the sarcolemma, which contains sarcoplasm, the cytoplasm of muscle cells. A muscle fiber is composed of many myofibrils, which contain sarcomeres with light and dark regions that give the cell its striated appearance.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A- Cardiac muscle has automaticity which allows the muscle to contract spontaneously without any electrical or hormonal stimuli . So option A is not correct Option C- Smooth muscles require phosphorylation of the Myosin light chain by Myosin light chain kinase (MLCK) for contraction to occur. In the above question after the myosin light chain kinase was blocked, the muscle continues to contract after stimulation. So option C is also false.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Suppose you are experimenting with skeletal muscle preparation. You want to measure isotonic contractions in that skeletal muscle preparation. Increasing the length of the preparation beyond the optimal length before the electrical stimulation would produce which of the following changes to active and passive tension?", "options": [{"label": "A", "text": "Increase active tension and increase passive tension", "correct": false}, {"label": "B", "text": "Increase active tension and decrease passive tension", "correct": false}, {"label": "C", "text": "Decrease active tension and increase passive tension", "correct": true}, {"label": "D", "text": "Decrease active tension and decrease passive tension", "correct": false}], "correct_answer": "C. Decrease active tension and increase passive tension", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Decrease active tension and increase passive tension As the sarcomere is stretched, elastic elements of the sarcomere are passively stretched, and tension increases. So the passive tension increases Active tension decreases because as the sarcomere is stretched, the actin and myosin overlap decreases and on stimulation fewer cross-bridges form, and thus less active tension is produced. So the correct option with the correct combination is C.</p>\n<p><strong>Highyeild:</strong></p><p>The active tension in the length–tension curve is generated by the contractile element of the sarcomere, that is, the interaction between the myofibrils. Passive tension is the force created by elongating the connective tissue elements within the muscle-tendon unit.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- The rest of the other options are false. Both the tension that a muscle develops when stimulated to contract isometrically (the total tension) and the passive tension exerted by the unstimulated muscle vary with the length of the muscle The length of the muscle can be varied by changing the distance between its two attachments . At each length, the passive tension is measured, the muscle is then stimulated electrically, and the total tension is measured. The difference between the two values at any length is the amount of tension actually generated by the contractile process, the active tension.</p>\n<p><strong>Extraedge:</strong></p><p>The length of the muscle at which the active tension is maximal is usually called its optimal resting length. The term comes originally from experiments demonstrating that the length of many of the muscles in the body at rest is the length at which they develop maximal tension. The observed length-tension relation in skeletal muscle can be explained by the sliding filament mechanism of muscle contraction. When the muscle fiber contracts isometrically, the tension developed is proportional to the number of cross-bridges between the actin and the myosin molecules. When the muscle is stretched, the overlap between actin and myosin is reduced and the number of cross-linkages is therefore reduced. Conversely, when the muscle is appreciably shorter than the resting length, the distance the thin filaments can move is reduced. The velocity of muscle contraction varies inversely with the load on the muscle. At a given load, the velocity is maximal at the resting length and declines if the muscle is shorter or longer than this length.</p>\n<p><strong>Table:</strong></p><p>Types of\n skeletal muscle\n fibers Muscle\n fiber type grouping commonly occurs due to reinnervation of denervated muscle\n fibers in peripheral nerve damage. Type I Type II CONTRACTION\n VELOCITY Slow Fast FIBER\n COLOR Red White PREDOMINANT\n METABOLISM Oxidative\n phosphorylation → sustained contraction Anaerobic\n glycolysis MITOCHONDRIA,\n MYOGLOBIN ↑ ↓ TYPE OF\n TRAINING Endurance\n training Weight/resistance\n training, sprinting</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following is NOT a Sarcolemmal protein?", "options": [{"label": "A", "text": "Perlecan", "correct": true}, {"label": "B", "text": "Dystrophin", "correct": false}, {"label": "C", "text": "Dystroglycan", "correct": false}, {"label": "D", "text": "Sarcoglycan", "correct": false}], "correct_answer": "A. Perlecan", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Perlecan Perlecan is not a Sarcolemmal protein. Perlecan, a large basement membrane heparan sulfate proteoglycan , is expressed in a wide array of tissues where it regulates diverse cellular processes including bone formation, inflammation, cardiac development, and angiogenesis.</p>\n<p><strong>Highyeild:</strong></p><p>The large dystrophin protein (molecular mass 427,000 Da) forms a rod that connects the thin actin filaments to the transmembrane protein-dystroglycan in the sarcolemma –dystroglycan is connected to merosin (merosin refers to laminin that contains the〈2 subunit in their trimeric makeup) in the extracellular matrix by-dystroglycan. The dystroglycan is in turn associated with a complex of four transmembrane glycoproteins and sarcoglycan. The dystrophin-glycoprotein complex: Dystrophin connects F-actin to the two members of the dystroglycan (DG) complex, α and β-dystroglycan, and these in turn connect to the merosin subunit of laminin 211 in the extracellular matrix. The sarcoglycan complex of four glycoproteins, α-, β-, γ-, and δ-sarcoglycan, sarcospan, and syntropins are all associated with the dystroglycan complex. There are muscle disorders associated with loss, abnormalities, or both of the sarcoglycans and merosin.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. Dystrophin is a protein that is found in the sarcolemma facing the sarcoplasm. It functions as a cytoskeletal integrator giving the membrane stability. It protects the muscle cells from contraction-induced damage. Genetic mutations of the dystrophin complex cause muscular weakness and muscular dystrophy. Option C and Option D. α-Dystroglycan links to the extracellular components (laminin, neurexin, and agrin) with β-dystroglycan, which is a transmembrane glycoprotein and binds not only to dystrophin, a cytoskeletal protein but also to sarcoglycan.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 16 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A 19-year-old woman with a history of diplopia and paresthesia is diagnosed with multiple sclerosis (MS). MS is a demyelinating disease characterized by a failure of nerve conduction. Immersion of an affected limb in a cold bath restores nerve conduction in many of these patients. The explanation often cited for this effect is that cold increases the duration of the action potential. Which of the following best explains why increasing the duration of the action potential can restore nerve conduction in patients with MS?", "options": [{"label": "A", "text": "The capacitance of the nerve fiber membrane is increased.", "correct": false}, {"label": "B", "text": "The duration of the refractory period is increased.", "correct": false}, {"label": "C", "text": "The potassium conductance of the membrane is increased.", "correct": false}, {"label": "D", "text": "The amount of sodium entering the nerve with each action potential increases.", "correct": true}], "correct_answer": "D. The amount of sodium entering the nerve with each action potential increases.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The amount of sodium entering the nerve with each action potential increases. In order for the propagation of an action potential to occur, the depolarization produced by one action potential must depolarize the adjacent patch of the excitable membrane to the threshold level.</p>\n<p><strong>Highyeild:</strong></p><p>In demyelinating diseases, such as multiple sclerosis, too much charge leaks from the membrane, and as a result, not enough charge is available to bring the next patch or membrane to the Increasing the duration of the action potential increases the amount of charge entering the cell and therefore increases the probability that the next patch of the excitable membrane will be depolarized to the threshold.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A: Increasing the duration of the refractory period will not affect the amount of charge entering the Option B: Depolarizing the membrane and increasing potassium conductance will make it more difficult to produce an action potential. Option C: If membrane capacitance is increased, the amount of charge required to excite the next patch of the membrane will be increased.</p>\n<p><strong>Extraedge:</strong></p><p>In multiple sclerosis, the selective permeability of neurons is lost due to autoimmune destruction of the Myelin sheath. Loss of myelin leads to leakage of through voltage-gated channels, hyperpolarization, and failure to conduct action potentials. Initial presentation commonly includes reports of paraparesis (weakness in lower extremities); paraesthesia; numbness; urinary incontinence; and heat intolerance (as already explained heat will prevent the propagation of action potential by reducing the Action Potential Duration). Clinical assessment often reports optic neuritis, characterized by blurred vision, a change in color perception, visual field defect (central scotoma), pain with eye movements; dysarthria; and dysphagia. Symptoms are often exacerbated by increased body temperature or increased ambient temper. Diagnosing MS is very difficult and generally is delayed until multiple episodes occur with deficits separated in time and space. Nerve conduction tests can detect slowed conduction in motor and sensory pathways. Cerebral spinal fluid analysis can detect the presence of oligoclonal bands indicative of an abnormal immune reaction against myelin. The most definitive assessment is magnetic resonance imaging (MRI) to visualize multiple scarred (sclerotic) areas or plaques in the brain. These plaques often appear in the periventricular regions of the cerebral hemispheres.</p>\n<p><strong>Table:</strong></p><p>Multiple sclerosis Autoimmune inflammation and demyelination of CNS (brain and spinal\n cord) with subsequent axonal damage. Can present with Optic neuritis (acute\n painful monocular visual loss, associated with relative afferent pupillary defect) ■ Brainstem/cerebellar syndromes (eg, diplopia, ataxia, scanning\n speech, intention tremor, nystagmus/INO [bilateral > unilateral]) Pyramidal tract\n demyelination (eg, weakness, spasticity) ■ Spinal cord syndromes (eg, electric shock-like sensation along\n cervical spine on neck flexion, neurogenic bladder, paraparesis, sensory\n manifestations affecting the trunk or one or more extremity) Symptoms may exacerbate with increased body temperature (eg, hot bath,\n exercise). Relapsing and remitting is most common clinical course. Most often\n affects females in their 20s and 30s; more common in individuals who grew up\n farther from equator and with low serum vitamin D levels. FINDINGS ↑ IgG level and myelin basic protein in CSF. Oligoclonal bands aid in\n diagnosis. MRI is gold standard. Periventricular plaques A (areas of\n oligodendrocyte loss and reactive gliosis). Multiple white matter lesions\n disseminated in space and time. TREATMENT Stop relapses and halt/slow progression with disease-modifying\n therapies (eg, B-interferon, glatiramer, natalizumab). Treat acute flares\n with IV steroids. Symptomatic treatment for neurogenic bladder\n (catheterization, muscarinic antagonists, botulinum toxin injection),\n spasticity (baclofen, GABA receptor agonists), pain (TCAs, anticonvulsants</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 52-year-old male was given a shot of procaine prior to oral surgery to extract an abscessed tooth. Preventing the inactivation of sodium channels by local anesthetics will decrease which of the following?", "options": [{"label": "A", "text": "The relative refractory period of nerve cells.", "correct": false}, {"label": "B", "text": "The upstroke velocity of nerve cell action potentials.", "correct": true}, {"label": "C", "text": "The downstroke velocity of nerve cell action potentials.", "correct": false}, {"label": "D", "text": "The magnitude of the overshoot in nerve cell action potentials.", "correct": false}], "correct_answer": "B. The upstroke velocity of nerve cell action potentials.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The upstroke velocity of nerve cell action potentials. Preventing the inactivation of sodium channels by local anesthetics will decrease the upstroke velocity of nerve cell action potentials. Procaine reversibly and preferentially binds to active sites on neuronal voltage-gated sodium channels. This binding occurs preferentially during activated states and causes selective inhibition of the open configuration of the sodium channel, thereby preventing sodium influx. The interruption of this influx prevents depolarization needed to initiate and propagate action potentials along the nerve.</p>\n<p><strong>Highyeild:</strong></p><p>Local or regional anesthesia is used to block the conduction of action potentials in sensory and motor nerve fibers. This usually occurs as a result of the blockade of voltage-gated Na+ channels on the nerve cell membrane. This causes a gradual increase in the threshold for electrical excitability of the nerve, a reduction in the rate of rise of the action potential, and a slowing of axonal conduction velocity.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options: Option A. The relative refractory period is the interval of time during which a second action potential can be initiated, but initiation will require a greater stimulus than before. Refractory periods are caused by the inactivation gate of the Na+ channel. Option D. The overshoot is the peak of the action potential where the membrane potential is positive. The falling phase repolarizes the membrane potential, and the undershoot takes the membrane potential more negatively than the resting membrane potential . After the undershoot, the membrane potential returns to rest.</p>\n<p><strong>Extraedge:</strong></p><p>Nociceptive fibers (unmyelinated C fibers) are the most sensitive to the blocking effect of local anesthetics. This is followed by sequential loss of sensitivity to temperature, touch, and deep pressure. Motor nerve fibers are the most resistant to the actions of local anesthetics. That is susceptibility to Local anesthetics: C>B>A nerve fibers Susceptibility to hypoxia: B>A>C Susceptibility to pressure: A>B>C Susceptibility To: Most Susceptible Intermediate Least Susceptible Hypoxia B A C Pressure A B C Local anesthetics C B A</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The current caused by the opening of which of the following channels contributes to the repolarization phase of the action potential of the ventricular fibers?", "options": [{"label": "A", "text": "Na+ channels", "correct": false}, {"label": "B", "text": "CI- channels", "correct": false}, {"label": "C", "text": "Ca2+ channels", "correct": false}, {"label": "D", "text": "K+ channels", "correct": true}], "correct_answer": "D. K+ channels", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>K+ channels Phase 3: K+ efflux takes place in the Repolarization phase.</p>\n<p><strong>Highyeild:</strong></p><p>PHASES OF VENTRICULAR ACTION POTENTIAL Phase 0: rapid sodium influx: rapid depolarization phase Phase 1: potassium efflux and occurs: partial or early repolarization phase Phase 2: potassium efflux and calcium influx take place: plateau phase Phase 3: potassium efflux takes place: final repolarization phase Phase 4: the resting state is attained Shown below is an image summarizing the phases of the ventricular action potential. The ventricular action potential is composed of four phases: phase 0 is depolarization, phase 1 is early repolarization, phase 2 is a plateau, phase 3 is rapid repolarization and phase 4 is the resting potential. The different phases depend on the opening and/or closure of specific ion channels.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options: Option A. At the beginning of the a ction potential, phase 1, specialized membrane proteins (voltage-gated sodium channels) in the cell membrane selectively allow sodium ions to enter the cell. Option B. Chloride flows through activated GABAA receptors into the neurons causing hyperpolarization or shunting inhibition, and in turn, inhibits action potential (AP) generation. Option C. In Phase 2, the delayed opening of more Ca2+-activated K+ channels, which are activated by a build-up of Ca2+ in the sarcoplasm, while the Ca2+ channels close, ends the plateau. This leads to repolarisation. In phase 3, Voltage-gated Ca2+ channels closed.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "There is a mutation of the gene coding for the ryanodine receptors in malignant hyperthermia. Which of the following statements best explains the increased heat production in malignant hyperthermia?", "options": [{"label": "A", "text": "Increased muscle metabolism by an excess of calcium", "correct": true}, {"label": "B", "text": "Thermic effect of blood", "correct": false}, {"label": "C", "text": "Increased sympathetic discharge", "correct": false}, {"label": "D", "text": "Mitochondria thermogenesis", "correct": false}], "correct_answer": "A. Increased muscle metabolism by an excess of calcium", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Increased muscle metabolism by an excess of calcium Malignant Hyperthermia is associated with a genetic defect in the RyR1Q calcium channel of the skeletal muscle sarcoplasmic reticulum that permits uncontrolled calcium release from the sarcoplasmic reticulum when precipitating drugs are given. The ryanodine receptor or calcium release channel on the sarcoplasmic reticulum (SR) is normally opened when skeletal muscle is activated.</p>\n<p><strong>Highyeild:</strong></p><p>The flow of calcium through the open ryanodine receptor binds to troponin and initiates muscle contraction. The metabolic activity accompanying muscle contraction can warm the body. If a mutation in the ryanodine receptor causes the uncontrolled release of calcium from the SR, the body temperature can rise to levels that cause brain damage.</p>\n<p><strong>Extraedge:</strong></p><p>Abnormalities in the ryanodine receptor 1 gene are commonly detected in people who have experienced an episode of malignant hyperthermia. The typical signs of malignant hyperthermia are due to a hypercatabolic state, which presents as a very high temperature, an increased heart rate and abnormally rapid breathing, increased carbon dioxide production, increased oxygen consumption, mixed acidosis, rigid muscles, and rhabdomyolysis. Malignant hyperthermia caused by Volatile anesthetic agents or succinylcholine in those who are susceptible. Susceptibility can occur due to at least six genetic mutations, with the most common one being of the RYR1 gene. These genetic variations are often inherited in an autosomal dominant Treatment is with dantrolene and rapid cooling along with other supportive measures. The avoidance of potential triggers is recommended in susceptible people.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 55-year-old female visited her doctor with complaints of pain in her lower back for the last 3 months. While giving her history, she says that she feels excessive fatigue and tiredness and she got a fracture in her left radius 2 months back. Her blood investigations were done and reports showed significant vitamin D deficiency. The doctor prescribed him a vitamin D tablet which will absorb with the help of which component of the cell membrane?", "options": [{"label": "A", "text": "Lipid", "correct": true}, {"label": "B", "text": "Aquaporins", "correct": false}, {"label": "C", "text": "Protein pump", "correct": false}, {"label": "D", "text": "Ion channels", "correct": false}], "correct_answer": "A. Lipid", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Lipid Vitamin D is a fat-soluble vitamin and it is a function of the lipid component of the cell membrane to absorb these fat-soluble vitamins along with fatty acids and cholesterol . Therefore, option A is true.</p>\n<p><strong>Highyeild:</strong></p><p>Fat-soluble vitamins include vitamins A, D, E, and K. Fat-soluble vitamins play integral roles in a multitude of physiological processes such as vision, bone health, immune function, and coagulation.</p>\n<p><strong>Random:</strong></p><p>Explanation for incorrect Options:- Option B: Aquaporins are channels made by protein components of cell membranes and they help water move inside a cell. Option C: Protein pumps are made up of protein in the cell membrane and not fat. They use ATP for ion movement in a cell. Option D: Ion channels are also tunnel proteins they help in ion movement in cells.</p>\n<p><strong>Table:</strong></p><p>Essential fatty acids Polyunsaturated fatty acids that cannot be\n synthesized in the body and must be provided in the diet (eg, nuts/seeds,\n plant oils, seafood). Linoleic acid (omega-6) is metabolized to arachidonic\n acid, which serves as the precursor to leukotrienes and prostaglandins.\n Linolenic acid (omega-3) and its metabolites have cardioprotective and\n antihyperlipidemic effects. In contrast, consumption of trans-unsaturated\n fatty acids (found in fast food) promotes cardiovascular disease by ↑ LDL and\n HDL Vitamins: fat soluble A, D, E, K. Absorption dependent on bile\n emulsification, pancreatic secretions, and intact ileum. Toxicity more common\n than for water-soluble vitamins because fat-soluble vitamins accumulate in\n fat. Malabsorption syndromes with steatorrhea (eg,\n cystic fibrosis and celiac disease) or mineral oil intake can cause\n fat-soluble vitamin deficiencies. Vitamins: water soluble B ₁ (thiamine: TPP) B2 (riboflavin: FAD, FMN) B3 (niacin: NAD) B (pantothenic acid: CoA) B6 (pyridoxine: PLP) B. (biotin) Bo (folate) B12 (cobalamin) C (ascorbic acid) Wash out easily from body except B12 and By. B ₁₂ stored in liver for 3-4 years. By stored in\n liver for 3-4 months. B-complex deficiencies often result in dermatitis,\n glossitis, and diarrhea. Can be coenzymes (eg, ascorbic acid) or precursors\n to coenzymes (eg, FAD, NAD\"</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A neurologist studied the brain functioning of experimental rats with Parkinson’s disease. He reported the presence of alterations in brain sites of electric impulse transmission responsible for neurodegenerative diseases. The image depicts brain sites of electric impulse transmission. Select the incorrect:", "options": [{"label": "A", "text": "Synapse", "correct": false}, {"label": "B", "text": "Neuromuscular junction", "correct": false}, {"label": "C", "text": "Dendrodendritic", "correct": true}, {"label": "D", "text": "None", "correct": false}], "correct_answer": "C. Dendrodendritic", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683534306209-QTDY046006IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Dendrodendritic Dendrodendritic synapses are connections between the dendrites of two different neurons . This is in contrast to the more common axodendritic synapse (chemical synapse) where the axon sends signals and the dendrite receives them. Dendrodendritic synapses are activated in a similar fashion to axodendritic synapses with respect to using a chemical synapse.</p>\n<p><strong>Random:</strong></p><p>Explanation for incorrect Options: Option A. Synapse, also called neuronal junction, is the site of transmission of electric nerve impulses between two nerve cells (neurons) or between a neuron and a gland or muscle cell (effector). Option B . neuromuscular junction A synaptic connection between a neuron and a muscle cell is called on the types and properties of synapses in the experimental rats. He reported a specific type of synapse that was related to various degenerative diseases such as muscular junction</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "New autism spectrum disorders (ASD), Down syndrome, startle disease, and epilepsy. The image gives features of the synapse. Select the correct synapse in the image:", "options": [{"label": "A", "text": "Chemical synapse", "correct": true}, {"label": "B", "text": "Axodendritic synapse", "correct": false}, {"label": "C", "text": "Axo axonic synapse", "correct": false}, {"label": "D", "text": "All incorrect", "correct": false}], "correct_answer": "A. Chemical synapse", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Chemical synapse Chemical synapses are biological junctions through which neurons' signals can be sent to each other and to non-neuronal cells such as those in muscles or glands.</p>\n<p><strong>Highyeild:</strong></p><p>Chemical synapses allow neurons to form circuits within the central nervous system. They are crucial to the biological computations that underlie perception and thought. They allow the nervous system to connect to and control other systems of the body. At a chemical synapse, one neuron releases neurotransmitter molecules into a small space (the synaptic cleft) that is adjacent to another neuron. The neurotransmitters are contained within small sacs called synaptic vesicles and are released into the synaptic cleft by exocytosis. These molecules then bind to neurotransmitter receptors on the postsynaptic cell.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. Axodendritic synapse - Axodendritic synapses, probably the most prominent kind of synapses, are synapses that one neuron makes onto the dendrite of another neuron. Option C. Axo axonic synapse - Axoaxonic synapses are synapses made by one neuron onto the synapse of another neuron.</p>\n<p><strong>Extraedge:</strong></p><p>Differences between chemical and electrical synapse Chemical synapse Transmission is by Neurotransmitters . Most of the synapses are of this type. They conduct in one direction . More vulnerable to fatigue on repeated stimulation, hypoxia, and PH changes. Slow speed causes synaptic delay as it allows for a large number of synapses per neuron. Electrical synapse Transmission is by gap junctions and low-resistance - bridges - ions pass easily Seen in some places, g., the retina, olfactory bulb, hippocampus, and cerebral cortex They conduct in both directions. Insensitive to hypoxia. Rapid efficient transmission with no delay as not too many synapses per neuron. Types Of Synapses:- Axodendritic synapse - Type I (most common) - Motor neurons of the spinal cord, excitatory synapse in the cerebral cortex, climbing fibers of the Axosomatic synapse - Type-ll (less common) - Motor neurons of the spinal cord, basket cells of the cerebellum, autonomic ganglia. Axoaxonic synapse (least common) - Seen in the spinal cord. Dendrodendritic synapse (rare) - seen in olfactory bulb between mitral and granule cells.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "An investigator studied the behavior of human beings in a state of fear and aggression. He reported changes in the ionic transport across the synapse. The image depicts a type of synapse linked with the above findings as, Select the correct synapse:-", "options": [{"label": "A", "text": "Axo axonic synapse", "correct": false}, {"label": "B", "text": "Chemical synapse", "correct": false}, {"label": "C", "text": "Electrical synapse", "correct": true}, {"label": "D", "text": "Neuromuscular synapse", "correct": false}], "correct_answer": "C. Electrical synapse", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683534306346-QTDY046008IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Electrical synapse An electrical synapse is a mechanical and electrically conductive link between two neighboring neurons that is formed at a narrow gap between the pre and postsynaptic neurons known as a gap junction .</p>\n<p><strong>Highyeild:</strong></p><p>At gap junctions, such cells approach within about 3.8 nm of each other, a much shorter distance than the 20- to 40-nanometer distance that separates cells at a chemical synapse. Compared to chemical synapses, electrical synapses conduct nerve impulses faster, but, unlike chemical synapses, they lack gain—the signal in the postsynaptic neuron is the same or smaller than that of the originating neuron. Electrical synapses are often found in neural systems that require the fastest possible response, such as defensive reflexes.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A . Axo axonic synapse - Synapse between the axon of one neuron and with the axon of other neurons. Option B. Chemical synapse - Synapse characterized by the release of neurotransmitters across the synapse leading to nerve impulse conduction. Option D. Neuromuscular synapse - Synapse between skeletal muscle and neurons leading to muscle contractility.</p>\n<p><strong>Extraedge:</strong></p><p>Differences between chemical and electrical synapse Chemical synapse Transmission is by Neurotransmitters . Most of the synapses are of this type. They conduct in one direction . More vulnerable to fatigue on repeated stimulation, hypoxia, and PH changes. Slow speed causes synaptic delay as it allows for a large number of synapses per neuron. Electrical synapse Transmission is by gap junctions and low-resistance - bridges - ions pass easily Seen in some places, g., the retina, olfactory bulb, hippocampus, and cerebral cortex. They conduct in both directions. Insensitive to hypoxia. Rapid efficient transmission with no delay as not too many synapses per neuron. Types Of Synapses:- Axodendritic synapse - Type I (most common) - Motor neurons of the spinal cord, excitatory synapse in the cerebral cortex, climbing fibers of the Axosomatic synapse - Type-ll (less common) - Motor neurons of the spinal cord, basket cells of the cerebellum, autonomic ganglia. Axoaxonic synapse (least common) - Seen in the spinal cord. Dendrodendritic synapse (rare) - seen in olfactory bulb between mitral and granule cells.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The patient aged 34 years, was a teacher and he presented with occasional episodes of unconsciousness before the interview or before the stage performance to the neurologist. Examination and tests reported no abnormality. The neurologist did counseling of the patient to understand the sequel of psychogenic shock and how to manage himself without any medication. Select the incorrect statement?", "options": [{"label": "A", "text": "Neuronal impulse transmission and excitability are dependent on the body's build.", "correct": false}, {"label": "B", "text": "Temporary cessation of oxygen supply to the brain for a few seconds due to fear or apprehension causes complete in-excitability of some neurons.", "correct": false}, {"label": "C", "text": "Brain hypoxia derives person's unconscious", "correct": false}, {"label": "D", "text": "All correct", "correct": true}], "correct_answer": "D. All correct", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>All correct There is a temporary cessation of oxygen supply to the brain for a few seconds due to fear or apprehension causing complete in-excitability of some neurons. This causes brain hypoxia that deprives a person unconscious for a few seconds due to nerve impulse cessation and neuronal in-excitability.</p>\n<p><strong>Highyeild:</strong></p><p>The neurons of the hippocampus, parieto-occipital lobe and cerebellum are particularly sensitive. As hypoxia becomes more severe, the damage extends to the entire cerebral cortex and deep nuclei and ultimately to the brainstem.</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option A. Neuronal impulse transmission and excitability are dependent on the adequate blood supply to the brain.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Physiologists determined that a 10% increase in alveolar ventilation will decrease PaCO2 by 4 mm Hg. It results in an increase in arterial pH from 7.40 to 7.45 all within seconds. Select the incorrect option:", "options": [{"label": "A", "text": "Increase in neuronal excitability", "correct": false}, {"label": "B", "text": "Decrease in neuronal excitability", "correct": true}, {"label": "C", "text": "Can cause cerebral epileptic seizures at pH 8.0", "correct": false}, {"label": "D", "text": "A short sequence of hyperventilation in a predisposed person can precipitate epilepsy", "correct": false}], "correct_answer": "B. Decrease in neuronal excitability", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Decrease in neuronal excitability Alkaline pH increases neuronal excitability in some neurons.</p>\n<p><strong>Highyeild:</strong></p><p>Neuronal excitability is highly susceptible to fluctuations in intra- and extracellular pH. A rise in pH increases neuronal activity, whereas it is dampened by a fall in Neuronal activity per se also challenges pH homeostasis by the increase of metabolic acid equivalents. Moreover, the negative membrane potential of neurons promotes the intracellular accumulation of protons.</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option A . Alkalosis causes an increase in neuronal excitability. Option C. Neuronal excitability can cause cerebral epileptic seizures at pH 8.0. Option D. For persons predisposed to epilepsy, a short sequence of hyperventilation can precipitate epilepsy.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A patient at the age of 34 years presented with difficulty breathing, dryness of mouth, flushed face, fruity-smelling breath, and severe headache. Relatives gave H/O of diabetes and administered oral hypoglycemic for treatment. The diagnosis was diabetic ketoacidosis which certainly affects neuronal excitability and synapse functioning in the brain. Select the incorrect statement:", "options": [{"label": "A", "text": "Neuronal excitability is highly elevated", "correct": true}, {"label": "B", "text": "Neuronal excitability is depressed", "correct": false}, {"label": "C", "text": "Synapse functioning impaired", "correct": false}, {"label": "D", "text": "May progress into a coma", "correct": false}], "correct_answer": "A. Neuronal excitability is highly elevated", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Neuronal excitability is highly elevated Acidosis greatly depresses neuronal activity; a fall in pH from 7.4 to below 7.0 usually causes a comatose state. For example, in very severe diabetic or uremic acidosis, coma almost always develops.</p>\n<p><strong>Highyeild:</strong></p><p>Acidosis decreases low Ca2+ -induced neuronal excitation by inhibiting the activity of calcium-sensing cation channels. Acidosis impairs neurotransmitter uptake processes.</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option B . In low pH and acidosis, neuronal excitability is depressed. Option C. Synapse functioning is impaired due to poor neuronal excitability in the brain. Option D. Diabetic ketoacidosis, if not treated in time, may progress into a</p>\n<p><strong>Table:</strong></p><p>Diabetic ketoacidosis Hyperosmolar hyperglycemic state PATHOGENESIS Insulin noncompliance or ↑ requirements due to ↑ stress (eg,\n infection) → lipolysis and oxidation of free fatty acids → ↑ ketone bodies (B-hydroxybutyrate\n > acetoacetate). Insulin deficient, ketones present Profound hyperglycemia → excessive osmotic diuresis → dehydration and\n ↑ serum osmolality → HHS. Classically seen in older patients with type 2 DM\n and limited ability to drink. Insulin present, ketones deficient. SIGNS/SYMPTOMS DKA is Deadly: Delirium/psychosis, Kussmaul respirations (rapid, deep\n breathing), Abdominal pain/nausea/vomiting, Dehydration. Fruity breath odor\n due to exhaled acetone. Thirst, polyuria, lethargy, focal neurologic deficits, seizures. LABS Hyperglycemia, ↑ H, HCO3 († anion gap metabolic acidosis), ↑ urine and\n blood ketone levels, leukocytosis. Normal/t serum K+, but depleted\n intracellular K† due to transcellular shift from insulin and acidosis.\n Osmotic diuresis ↑ K+ loss in urine total body K+ depletion. Hyperglycemia (often > 600 mg/dL), † serum osmolality (>320\n mOsm/kg), normal pH (no acidosis), no ketones. Normal/t serum K+, ↓\n intracellular K*. COMPLICATIONS Life-threatening mucormycosis, cerebral edema, cardiac arrhythmias Can progress to coma and death if untreated. TREATMENT IV fluids, IV insulin, and K+ (to replete intracellular stores).\n Glucose may be required to prevent hypoglycemia from insulin therapy.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A physiologist studied the effect of alkaloids namely caffeine, theophylline, and theobromine, which he isolated from coffee, tea, and cocoa. He studied the effect of these alkaloids on the neuronal excitability of experimental rats. He concluded that it was correct:", "options": [{"label": "A", "text": "Reduce the threshold for excitation of neurons", "correct": false}, {"label": "B", "text": "Increase neuronal excitability", "correct": false}, {"label": "C", "text": "Synapse transmission becomes faster", "correct": false}, {"label": "D", "text": "All correct", "correct": true}], "correct_answer": "D. All correct", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>All correct Many drugs are known to increase the excitability of neurons, and others are known to decrease excitability. For example, caffeine, theophylline, and theobromine, which are found in coffee, tea, and cocoa, respectively, all increase neuronal excitability, presumably by reducing the threshold for the excitation of neurons.</p>\n<p><strong>Highyeild:</strong></p><p>Gamma-aminobutyric acid (GABA) is an amino acid that functions as the primary inhibitory neurotransmitter for the central nervous system (CNS). It functions to reduce neuronal excitability by inhibiting nerve transmission.</p>\n<p><strong>Random:</strong></p><p>Explanation for other options:- Option A. Threshold of excitation (threshold): The level that a depolarization must reach for an action potential to occur. In most neurons the threshold is around -55mV to -65mV. Option B. The increased voltage-dependent sodium current could decrease the action potential threshold and increase the probability of action potential generation in response to synaptic excitation, thus increasing the excitability of the neuron . Option C. Synapse transmission becomes faster is attributable to the ability of the fast-acting neurotransmitters to open ligand-operated ion channels present in the plasma membrane of the postsynaptic cells.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A neurologist studied the role of neurotransmitters in inducing excitatory postsynaptic potentials in neurons and measured EPSP Parkinson’s disease and Alzheimer’s disease in a group of patients. Select the incorrect?", "options": [{"label": "A", "text": "Opening of sodium channels", "correct": false}, {"label": "B", "text": "Closing of sodium channels", "correct": true}, {"label": "C", "text": "Suppressed ionic conduction through chloride channels", "correct": false}, {"label": "D", "text": "Depressed conduction via potassium channels", "correct": false}], "correct_answer": "B. Closing of sodium channels", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Closing of sodium channels Opening of sodium channels takes place during EPSP.</p>\n<p><strong>Highyeild:</strong></p><p>The excitatory postsynaptic potential (EPSP) is a postsynaptic potential that makes the postsynaptic neuron more likely to fire an action potential. This temporary depolarization of postsynaptic membrane potential, caused by the flow of positively charged ions into the postsynaptic cell, is a result of opening ligand-gated ion channels.</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option A. Opening of sodium channels in EPSP Option C. Suppressed ionic conduction through chloride channels in EPSP to make the interior of the membrane more positive Option D. The conduction via potassium channels along with chloride channels is suppressed during EPSP to induce excitation.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A senior neurologist who studied the properties of synapses in different species reported the occurrence of “One-Way Conduction in Synapses” which is essential in nerve conduction in the brain. Select the type of synapse in which the phenomenon was reported.", "options": [{"label": "A", "text": "Chemical synapse", "correct": true}, {"label": "B", "text": "Electrical synapse", "correct": false}, {"label": "C", "text": "Inhibitory synapse", "correct": false}, {"label": "D", "text": "None", "correct": false}], "correct_answer": "A. Chemical synapse", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Chemical synapse Synaptic transmission is the process at synapses by which a chemical signal (a transmitter) is released from one neuron and diffuses to other neurons or target cells where it generates a signal which excites, inhibits, or modulates cellular activity. Through synaptic transmission, an electrical signal in one neuron passes from the terminal of its axon into another cell and starts in that cell an impulse having characteristics different from its own. Chemical synapse is the correct answer because In chemical synapses , the transmission of signals occurs through the release of neurotransmitters by the presynaptic neuron, which binds to receptors on the postsynaptic neuron.</p>\n<p><strong>Highyeild:</strong></p><p>Chemical synapses have one exceedingly important characteristic that makes them highly desirable for transmitting nervous system signals. This characteristic is that they always transmit the signals in one direction—that is, from the neuron that secretes the neurotransmitter, called the presynaptic neuron, to the neuron on which the transmitter acts, called the postsynaptic neuron. This phenomenon is the principle of one-way conduction at chemical synapses, and it is different from conduction through electrical synapses, which often transmit signals in either direction.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. In electrical synapses- There is no need for neurotransmitters to be released and received, so there is no synaptic delay. Additionally , electrical synapses allow for bidirectional signaling, meaning that signals can pass in both directions across the synapse . Option C. Inhibitory synapse - Are a subtype of chemical synapses where the neurotransmitter released by the presynaptic neuron inhibits the firing of the postsynaptic neuron. Inhibitory synapses, like excitatory synapses, rely on the release of neurotransmitters to signal across the synaptic cleft. However, in inhibitory synapses, the neurotransmitter binding to its receptor on the postsynaptic neuron results in a decrease in the postsynaptic neuron's activity, rather than an increase.</p>\n<p><strong>Table:</strong></p><p>Main modalities of synaptic transmissions. · a) Chemical synapse:- The arrival\nof action potential results in the activation of voltage ‐ gated Ca ⁺ channels, promoting the\nprobabilistic release of neurotransmitters by exocytosis from the presynaptic\nmembrane. The ionotropic and metabotropic receptors on the postsynaptic\nmembrane can detect and translate the information carried by neurotransmitters\ninto different postsynaptic behaviors, varying from changes in membrane\npotential to gene expression. · b) Electrical synapse:- Electrical\ntransmission is conducted by gap junctions (some clusters of intercellular\nchannels) between two adjacent cells. The transmission is bidirectional: when\nan action potential is transmitted from pre ‐ synapse to\npostsynapse, the postsynaptic resting potential propagates concurrently to the\npre ‐ synapse. · c) Mixed synapse:- Chemical\nand electrical transmission coexist at mixed synapses. Chemical synapses (such\nas glutamate ‐ based) influence the connective\nstrength of electrical synapses by activating the NMDA receptors and CaMKII.\na–c) Adapted with permission.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "An electrophysiological study of a neuron in the Enteric nervous system detects a fast EPSP. Which is the most likely property associated with the EPSP?", "options": [{"label": "A", "text": "Acetylcholine (ACh) receptors", "correct": true}, {"label": "B", "text": "Suppression of hyperpolarizing after-potentials", "correct": false}, {"label": "C", "text": "Receptor activation of adenylyl cyclase", "correct": false}, {"label": "D", "text": "Hyperpolarization of the membrane potential", "correct": false}], "correct_answer": "A. Acetylcholine (ACh) receptors", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Acetylcholine (ACh) receptors The initial depolarization is produced by acetylcholine acting on the NN receptor. The slow EPSP is produced by acetylcholine acting on a muscarinic receptor on the membrane of the postganglionic neuron. The release of acetylcholine from postganglionic fibers acts on muscarinic cholinergic receptors.</p>\n<p><strong>Highyeild:</strong></p><p>Transmission in autonomic ganglia is mediated primarily by the actions of acetylcholine on nicotinic cholinergic receptors that are blocked by hexamethonium. These are called NN receptors to distinguish them from the nicotinic cholinergic receptors (NM) that are located at the neuromuscular junction and are blocked by D-tubocurarine (curare). Nicotinic receptors are ligand-gated ion channels; binding of an agonist to these receptors opens N+ and K+ channels to cause depolarization. The responses produced in postganglionic neurons by stimulation of their preganglionic innervation include both a fast excitatory postsynaptic potential (EPSP) that generates action potentials and a prolonged excitatory postsynaptic potential (slow EPSP). The slow response may modulate and regulate transmission through the sympathetic ganglia. The initial depolarization is produced by acetylcholine acting on the NN receptor. The slow EPSP is produced by acetylcholine acting on a muscarinic receptor on the membrane of the postganglionic neuron. The release of acetylcholine from postganglionic fibers acts on muscarinic cholinergic receptors.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B . Suppression of hyperpolarizing after-potentials : Wrong option Option C. Receptor activation of adenylyl cyclase: This is present in the heart and involves a slow postsynaptic EPSP. Option Hyperpolarization of the membrane potential: Hyperpolarization produces inhibitory responses. </p</p>\n<p><strong>Extraedge:</strong></p><p>Muscarinic cholinergic receptors are blocked by atropineº. Muscarinic receptors are GPCR and are divided into subtypes: M1-M5 M2 and M3 are the main subtypes found in autonomic target organs. M2 receptors are found in the heart; binding of an agonist to these receptors opens K+ channels and inhibits adenylyl cyclase. M3 receptors are located on smooth muscle and glands; binding of an agonist to these receptors leads to the formation of inositol 1,4,5-triphosphate (IP3) and diacylglycerol (DAG) and an increase in intracellular Ca2+. NN receptors are blocked by hexamethoniumº. NM receptors are blocked by D-tubocurarine (curare).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "In the Central nervous system, the myelin sheath is formed by:", "options": [{"label": "A", "text": "Oligodendrocytes", "correct": true}, {"label": "B", "text": "Schwann cells", "correct": false}, {"label": "C", "text": "Microglia", "correct": false}, {"label": "D", "text": "Astrocytes", "correct": false}], "correct_answer": "A. Oligodendrocytes", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Oligodendrocytes In the CNS of mammals, most neurons are myelinated, but the cells that form the myelin are Oligodendrocytes rather than Schwann cells. Unlike the Schwann cell, which forms the myelin between two nodes of Ranvier on a single neuron, Oligodendrocytes emit multiple processes that form myelin on many neighboring</p>\n<p><strong>Highyeild:</strong></p><p>Autoimmune reactions to the Myelin proteins cause Guillain-Barré syndrome, a peripheral demyelinating neuropathy. Mutations in myelin protein genes cause peripheral neuropathies that disrupt myelin and cause axonal degeneration (g., Charcot-MarieTooth disease).</p>\n<p><strong>Extraedge:</strong></p><p>There are three types of Macroglia: Oligodendrocytes are small with relatively few processes. Those in the white matter provide myelin and those in the grey matter support neurons. Schwann cells provide myelin to the peripheral nervous system. Each cell forms a segment of myelin sheath about 1 mm long; the sheath assumes its form as the inner tongue of the Schwann cell turns around the axon several times, wrapping in concentric layers. Intervals between segments of myelin are the nodes of Ranvier. Astrocytes are the most common glia in the CNS and are characterized by their starlike shape. They contact both capillaries and neurons and are thought to have a nutritive function. They are also involved in forming the blood-brain barrier.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The Phantom limb phenomenon can be described by which law?", "options": [{"label": "A", "text": "Weber Fechner law", "correct": false}, {"label": "B", "text": "Power law", "correct": false}, {"label": "C", "text": "Bell-Magendie law", "correct": false}, {"label": "D", "text": "Law of projection", "correct": true}], "correct_answer": "D. Law of projection", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Law of projection No matter where a particular sensory pathway is stimulated along its course to the cortex, the conscious sensation produced is referred to the location of the receptor. This principle is called the law of projection. Cortical stimulation experiments during neurosurgical procedures on conscious patients illustrate this phenomenon. For example, when the cortical receiving area for impulses from the left hand is stimulated, the patient reports sensation in the left hand, not in the head.</p>\n<p><strong>Highyeild:</strong></p><p>Between 50% and 80% of amputees experience phantom sensations, usually pain, in the region of their amputated limb. Phantom sensations may also occur after the removal of body parts other than the limbs. In patients who have had their leg amputated, single neuron recordings show that the thalamic region that once received input from the leg and foot now responds to stimulation of the stump (thigh). Others have demonstrated remapping of the somatosensory cortex. For example, in some individuals who have had an arm amputated, stroking different parts of the face can lead to the feeling of being touched in the area of the missing limb. Numerous theories have been evoked to explain this phenomenon. The current theory is based on evidence that the brain can reorganize if sensory input is cut off. The ventral posterior thalamic nucleus is one example where this change can occur. In patients who have had their leg amputated, single neuron recordings show that the thalamic region that once received input from the leg and foot now responds to stimulation of the stump (thigh). Others have demonstrated remapping of the somatosensory cortex. For example, in some individuals who have had an arm amputated, stroking different parts of the face can lead to the feeling of being touched in the area of the missing limb.</p>\n<p><strong>Random:</strong></p><p>Explanation for incorrect Option:- Option A. The law states that the change in a stimulus that will be just noticeable is a constant ratio of the original stimulus. Option C. The Bell-Magendie Law states that the ventral spinal roots transmit motor impulses and the posterior roots sensory impulses.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The membrane potential will depolarize by the greatest amount if the membrane permeability increases for which of the following?", "options": [{"label": "A", "text": "Potassium", "correct": false}, {"label": "B", "text": "Sodium", "correct": true}, {"label": "C", "text": "Chloride", "correct": false}, {"label": "D", "text": "Potassium and chloride", "correct": false}], "correct_answer": "B. Sodium", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Sodium The membrane potential will depolarize by the greatest amount if the membrane permeability increases for Sodium.</p>\n<p><strong>Highyeild:</strong></p><p>When the permeability of a particular ion is increased, the membrane potential moves toward the equilibrium potential for that ion. The equilibrium potentials for chloride (–80 mV) and potassium (–92 mV) are close to the resting membrane potential, so increases in their permeability have little effect on the resting membrane potential. The equilibrium potential for sodium (+60 mV) is very far from the resting membrane potential. Thus, increasing the permeability of sodium causes a large depolarization. Therefore, Option B: Sodium, would cause the greatest depolarization of the membrane potential if the membrane permeability increases.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. If the membrane permeability to potassium increases, more potassium ions will leave the cell , causing hyperpolarization of the membrane potential towards the potassium equilibrium potential. Therefore, increasing membrane permeability to potassium will not cause the greatest depolarization of the membrane potential, but rather the opposite effect of hyperpolarization. So, Option A: Potassium, is not the correct answer to the question. Option C. Chloride , will not cause the greatest depolarization of the membrane potential . Option D. In general, the depolarizing effect of increasing sodium permeability is greater than the hyperpolarizing effect of increasing potassium and chloride permeability, especially if the increase in sodium conductance is much larger than the increase in potassium and chloride conductance. Therefore, Option D: Potassium and chloride, will not cause the greatest depolarization of the membrane potential.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following is less during the overshoot of an action potential than during the resting state?", "options": [{"label": "A", "text": "Membrane conductance for sodium", "correct": false}, {"label": "B", "text": "Membrane conductance for potassium", "correct": false}, {"label": "C", "text": "Transference for sodium", "correct": false}, {"label": "D", "text": "Transference for potassium", "correct": true}], "correct_answer": "D. Transference for potassium", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Transference for potassium During an action potential, the conductances for sodium and for potassium are higher than at rest.</p>\n<p><strong>Highyeild:</strong></p><p>However, the conductance for sodium is higher than the conductance for potassium during the overshoot; as a result, the transference for potassium is less. For most types of axons, these changes consist of a rapid and transient rise in sodium (Na+) permeability, followed by a slower but more prolonged rise in potassium (K+) permeability. Both permeabilities are voltage-dependent, increasing as the membrane potential depolarizes.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following characteristics of an axon is most dependent on its diameter?", "options": [{"label": "A", "text": "The magnitude of its resting potential", "correct": false}, {"label": "B", "text": "The duration of its refractory period", "correct": false}, {"label": "C", "text": "The conduction velocity of its action potential", "correct": true}, {"label": "D", "text": "The overshoot of its action potential", "correct": false}], "correct_answer": "C. The conduction velocity of its action potential", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The conduction velocity of its action potential The conduction velocity of an action potential along an axon is proportional to the axon’s diameter for both unmyelinated and myelinated axons.</p>\n<p><strong>Highyeild:</strong></p><p>The resting membrane potential, the duration of the relative refractory period, and the magnitude of the action potential are dependent on the type and density of electrically excitable gates and the ability of the Na+, K+ -ATPase to establish and maintain the concentration gradients. These characteristics are not related in any systematic way to the axon diameter. The above-mentioned symptoms caused by extended periods of compression are seen in association with deep sleep with arms under their heads usually seen in patients with Alcohol intoxication (Saturday night palsy).</p>\n<p><strong>Extraedge:</strong></p><p>Types of mammalian nerve fibers. Fiber Type Function Fiber Diameter (μm) Conduction Velocity (m/s) Spike Duration (ms) Absolute Refractory Period (ms) Aα Proprioception; somatic motor 12-20 70-120 Aβ Touch, pressure 5-12 30-70 0.4-0.5 0.4-1 Aγ Motor to muscle spindles 3-6 15-30 Αδ Pain, temperature 2-5 12-30 B Preganglionic autonomic <3 3-15 1.2 1.2 C, Dorsal root Pain, temperature 0.4-1.2 0.5-2 2 2 C, Sympathetic Postganglionic sympathetic 0.3-1.3 0.7-2.3 2 2 2. Numerical classification of sensory nerve fibers. Number Origin Fiber Type La Muscle spindle, annulo-spiral ending Aα Ib Golgi tendon organ Aα Ll Muscle spindle, flower-spray ending: touch, pressure Aβ Lll Pain and cold receptors; some touch receptors Αδ Lv Pain, temperature, and other receptors Dorsal root C 3. Relative susceptibility of mammalian A, B, and C nerve fibers to conduction blocks produced by various agents:- Susceptibility To: Most Susceptible Intermediate Least Susceptible Hypoxia B A C Pressure A B C Local anesthetics C B A Susceptibility of pressure on Nerve fibers: A>B>C. Since Large diameter axons (A fibers) such as motor neurons, proprioception, touch, and pressure fibers are lost first and pain (C fibers) sensations remain intact. Patterns of this type are sometimes seen in individuals who sleep with their arms under their heads for long periods, causing compression of the nerves in the arms.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "True regarding Na+/K+ ATPase pump is:", "options": [{"label": "A", "text": "Pumps Na against a gradient", "correct": true}, {"label": "B", "text": "5 Na exchanged for 2K", "correct": false}, {"label": "C", "text": "Increases in intracellular Na", "correct": false}, {"label": "D", "text": "Hypocalcemia inhibits the pump", "correct": false}], "correct_answer": "A. Pumps Na against a gradient", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Pumps Na against a gradient Pumps Na against a gradient- The active transport mechanism that has been studied in the greatest detail is the sodium-potassium (Na+-K+) pump, a transport process that pumps sodium ions outward through the cell membrane of all cells and at the same time pumps potassium ions from the outside to the inside.</p>\n<p><strong>Highyeild:</strong></p><p>The sodium and potassium move against the concentration gradients. The Na+ K+-ATPase pump maintains the gradient of a higher concentration of sodium extracellularly and a higher level of potassium intracellularly.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: B. 5 Na exchanged for 2K- False as, two potassium ions bind on the outside of the carrier protein and three sodium ions bind on the inside, the ATPase function of the protein becomes activated. This device pumps three Na+ ions to the outside of the cell for every two K+ ions pumped to the interior Option: C . Increases in intracellular Na-False as, When sodium ions are transported out of cells by primary active transport , a large concentration gradient of sodium ions across the cell membrane usually develops, with high concentration outside the cell and low concentration inside. Option: D. Hypocalcemia inhibits the pump-False as, for calcium transport, the calcium pump is present.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following is not associated with nerve transmission?", "options": [{"label": "A", "text": "Na+", "correct": false}, {"label": "B", "text": "Mg+", "correct": true}, {"label": "C", "text": "Cl-", "correct": false}, {"label": "D", "text": "K+", "correct": false}], "correct_answer": "B. Mg+", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Mg+ Magnesium is not associated with nerve transmission.</p>\n<p><strong>Highyeild:</strong></p><p>Sodium, potassium, and chloride ions are the most important ions involved in the development of membrane potentials in nerve and muscle fibers, as well as in the neuronal cells in the nervous system. The concentration gradient of each of these ions across the membrane helps determine the voltage of the membrane potential.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest Options are correct. Sodium, chloride and potassium ions are associated with nerve transmission.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A traveling nerve impulse does not depolarize the area immediately behind it, because:", "options": [{"label": "A", "text": "It is hyperpolarized.", "correct": false}, {"label": "B", "text": "It is refractory.", "correct": true}, {"label": "C", "text": "It is not self-propagating.", "correct": false}, {"label": "D", "text": "The conduction is always orthodromic.", "correct": false}], "correct_answer": "B. It is refractory.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>It is refractory. A new action potential cannot occur in an excitable fiber as long as the membrane is still depolarized from the preceding action potential.</p>\n<p><strong>Highyeild:</strong></p><p>The reason for this restriction is that shortly after the action potential is initiated, the sodium channels (or calcium channels, or both) become inactivated and no amount of excitatory signal applied to these channels at this point will open the inactivation gates. The only condition that will allow them to reopen is for the membrane potential to return to or near the original resting membrane potential level. Then, within another small fraction of a second, the inactivation gates of the channels open, and a new action potential can be initiated. The period during which a second action potential cannot be elicited, even with a strong stimulus, is called the absolute refractory period.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Hyperpolarization is when the membrane potential becomes more negative at a particular spot on the neuron's membrane. Option C. This self-propagating action potential signal, which is an active process by the entry of Sodium through ion channels in the membrane, travels along the length of the axon. Option D. Orthodromic, therefore, means conducting impulses in the normal or correct direction;</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following is true regarding Renshaw inhibition?", "options": [{"label": "A", "text": "Collateral causes the inhibition", "correct": false}, {"label": "B", "text": "Inhibition of feedback propagation", "correct": false}, {"label": "C", "text": "Both", "correct": true}, {"label": "D", "text": "None", "correct": false}], "correct_answer": "C. Both", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Both The Renshaw cell directly inhibits the alpha motor neuron, using glycine as the neurotransmitter . This is called recurrent inhibition. It provides inhibitory feedback to the pool of alpha motor neurons to prevent excessive output.</p>\n<p><strong>Highyeild:</strong></p><p>Presynaptic and postsynaptic inhibition are usually produced by stimulation of certain systems converging on a given postsynaptic neuron (afferent inhibition). Neurons may also inhibit themselves in a negative feedback fashion (negative feedback inhibition). For instance, each spinal motor neuron regularly gives off a recurrent collateral that synapses with an inhibitory interneuron, which terminates on the cell body of the spinal neuron and other spinal motor neurons. This particular inhibitory neuron is sometimes called a Renshaw cell after its discoverer.</p>\n<p><strong>Extraedge:</strong></p><p>Renshaw cells are interneurons that are stimulated by the alpha motor neuron and then, by a feedback mechanism, inhibit the alpha motor neuron, causing It has also been shown that glycine is the inhibitory transmitter released by the Renshaw cells.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Sensory receptors that adapt rapidly are well suited to sensing:", "options": [{"label": "A", "text": "The weight of an object held in the hand.", "correct": false}, {"label": "B", "text": "The rate at which an extremity is being moved.", "correct": true}, {"label": "C", "text": "Resting body orientation in space.", "correct": false}, {"label": "D", "text": "Potentially hazardous chemicals in the environment.", "correct": false}], "correct_answer": "B. The rate at which an extremity is being moved.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The rate at which an extremity is being moved. Receptors that adapt rapidly cannot be used to transmit a continuous signal because they are stimulated only when the stimulus strength changes. Yet, they react strongly while a change is actually taking place. Therefore, these receptors are called rate receptors, movement receptors, or phasic receptors.</p>\n<p><strong>Highyeild:</strong></p><p>Predictive Function of the Rate Receptors. If one knows the rate at which some change in bodily status is taking place, the state of the body a few seconds or even a few minutes later can be predicted. Receptors located in or near the joints help detect the rates of movement of the different parts of the body.</p>\n<p><strong>Extraedge:</strong></p><p>Sensory receptors are specialized cells that detect changes in the environment and convert these changes into electrical signals that can be processed by the nervous system. It is common to group them into 5 classes: mechanoreceptors, thermoreceptors, nociceptors, electromagnetic receptors, and</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following is true about nerve action potential conduction?", "options": [{"label": "A", "text": "On activation, there is an influx of potassium and an efflux of sodium.", "correct": false}, {"label": "B", "text": "It is decremental in nature.", "correct": false}, {"label": "C", "text": "It does not follow all or none law.", "correct": false}, {"label": "D", "text": "It requires a threshold stimulus to be activated.", "correct": true}], "correct_answer": "D. It requires a threshold stimulus to be activated.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>It requires a threshold stimulus to be activated. Threshold for Initiation of the Action Potential. An action potential will not occur until the initial rise in membrane potential is great enough to create the positive feedback described in the preceding paragraph.</p>\n<p><strong>Highyeild:</strong></p><p>This occurs when the number of sodium ions entering the fiber becomes greater than the number of potassium ions leaving the fiber. A sudden rise in membrane potential of 15 to 30 millivolts is usually required. Therefore, a sudden increase in the membrane potential in a large nerve fiber from −90 millivolts up to about −65 millivolts usually causes the explosive development of an action potential. This level of −65 millivolts is said to be the threshold for stimulation. Other Option:- Option: A. On activation, there is an influx of potassium and efflux of sodium- Na+ enters the nerve cell and K+ leaves it during the action potential Option: B. It is decremental in nature. Option: C. It does not follow all or none law-The action potential fails to occur if the stimulus is subthreshold in magnitude, and it occurs with constant amplitude and form regardless of the strength of the stimulus if the stimulus is at or above threshold intensity. The action potential is therefore “all or none” in character and is said to obey the all-or-none law.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. On activation, there is an influx of potassium and efflux of sodium- Na+ enters the nerve cell and K+ leaves it during the action potential Option: B. It is decremental in nature. Option: C. It does not follow all or none law-The action potential fails to occur if the stimulus is subthreshold in magnitude, and it occurs with constant amplitude and form regardless of the strength of the stimulus if the stimulus is at or above threshold intensity. The action potential is therefore “all or none” in character and is said to obey the all-or-none law.</p>\n<p><strong>Extraedge:</strong></p><p>This occurs when the number of sodium ions entering the fiber becomes greater than the number of potassium ions leaving the fiber. A sudden rise in membrane potential of 15 to 30 millivolts is usually required. Therefore, a sudden increase in the membrane potential in a large nerve fiber from −90 millivolts up to about −65 millivolts usually causes the explosive development of an action potential. This level of −65 millivolts is said to be the threshold for stimulation.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 36 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "During the ingestion and digestion of a meal, peristaltic contractions are the primary type of contractions occurring in which of the following regions of the GI tract?", "options": [{"label": "A", "text": "Esophagus", "correct": true}, {"label": "B", "text": "Proximal Stomach", "correct": false}, {"label": "C", "text": "Jejunum", "correct": false}, {"label": "D", "text": "Ileum", "correct": false}], "correct_answer": "A. Esophagus", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Esophagus Peristaltic contractions are the primary, if not the only, contractions of the esophagus that result in the rapid transfer of material from the mouth to the stomach.</p>\n<p><strong>Highyeild:</strong></p><p>In the esophagus, small intestine, and large intestine, this muscle is arranged in two layers: an outer longitudinal muscle layer and an inner circular layer. In the stomach, an incomplete oblique layer also is present. The muscle in the pharynx, the upper esophageal sphincter (UES), the upper third or so of the esophagus, and the external anal sphincter is visceral striated muscle. The muscle in all other areas is smooth muscle.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. The proximal stomach undergoes mainly receptive relaxation and tonic contraction during the ingestion and digestion of a meal. Option C & D. In both the small and the large intestine , segmenting (phasic) contractions are most numerous.</p>\n<p><strong>Extraedge:</strong></p><p>Esophagus histology :- Nonkeratinized stratified squamous epithelium. Upper 1/3, striated muscle; middle and lower 2/3 smooth muscle, with some overlap at the transition.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Esophageal manometry is performed on a patient who is experiencing difficulty in swallowing. Between swallows, pressures above atmospheric pressure are recorded in the UES and LES, and pressures below atmospheric pressure are recorded in the thoracic esophageal body. Upon swallowing, the UES relaxes and a normal peristaltic contraction occurs in the upper esophagus. The peristaltic contraction occurring in the lower esophagus is slightly abnormal, but there is no relaxation of the LES. The defect in this patient most likely lies in which of the following structures?", "options": [{"label": "A", "text": "Extrinsic nerves innervating the esophagus", "correct": false}, {"label": "B", "text": "Intrinsic nerves of the esophagus", "correct": true}, {"label": "C", "text": "Smooth muscle of the esophagus", "correct": false}, {"label": "D", "text": "Striated muscle of the esophagus", "correct": false}], "correct_answer": "B. Intrinsic nerves of the esophagus", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Intrinsic nerves of the esophagus Normal resting pressures in the UES and LES, and normal peristalsis in the upper esophagus with swallowing indicate that the muscle, extrinsic nerves, and swallowing center are intact.</p>\n<p><strong>Highyeild:</strong></p><p>Contractions of the pharynx, UES, and the striated portion of the esophagus are coordinated by a central nervous system (CNS) center and are mediated by direct vagal innervation of the muscle. Events in the smooth muscle portion of the esophagus, LES, and orad stomach are coordinated by both central and enteric nerves acting on the muscle.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest Options are incorrect because the slightly abnormal peristaltic contractions of the lower esophagus and especially the lack of relaxation of the LES upon swallowing indicate a defect in the intrinsic nerves.</p>\n<p><strong>Extraedge:</strong></p><p>Segmenting and peristaltic contractions of the small intestine and segmenting (haustral) contractions and mass movements of the colon are regulated by slow waves, enteric and extrinsic nerve reflexes, and perhaps GI hormones.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A disease that results in the loss of enteric inhibitory motor neurons to the musculature of the digestive tract will most likely be expressed as:", "options": [{"label": "A", "text": "Rapid intestinal transit", "correct": false}, {"label": "B", "text": "Accelerated gastric emptying", "correct": false}, {"label": "C", "text": "Gastroesophageal reflux", "correct": false}, {"label": "D", "text": "Achalasia of the lower esophageal sphincter", "correct": true}], "correct_answer": "D. Achalasia of the lower esophageal sphincter", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Achalasia of the lower esophageal sphincter Achalasia is a primary esophageal disorder involving the body of the esophagus and lower esophageal sphincter affecting equally both genders and all ages.</p>\n<p><strong>Highyeild:</strong></p><p>While its etiology remains unclear, the pathophysiologic mechanism involves the destruction of the myenteric plexus responsible for esophageal peristalsis. Given the slow, initially oligosymptomatic progression and relatively low prevalence of disease, achalasia can remain undiagnosed for years. It is due to increased resting LES tone and incomplete relaxation on swallowing. The myenteric plexus of the esophagus is deficient at the LES in this condition and the release of NO and VIP is defective. In terms of diagnosis, esophageal manometry is the gold standard to diagnose achalasia. It can be treated by pneumatic dilation of the sphincter or incision of the esophageal muscle (myotomy). Inhibition of acetylcholine release by injection of botulinum toxin into the LES is also effective and produces relief that lasts for several months.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Dumping syndrome is a condition in which rapid intestinal transit. Option B. Rapid gastric emptying is seen in Zollinger-Ellison syndrome, gastrin-secreting tumors in the pancreas. Option C. The most common symptom of GERD is frequent heartburn.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 39-year-old man presented with abdominal pain and diarrhea. On investigations, multiple ulcers were seen in the proximal and distal duodenum and in the jejunum. The gastric pH was found to be 1.2 with a serum gastrin concentration of 2000 pg/ml. Which of the following is the primary site for the production of GI hormone raised in this patient?", "options": [{"label": "A", "text": "Pylorus", "correct": false}, {"label": "B", "text": "Antrum", "correct": true}, {"label": "C", "text": "Pancreas", "correct": false}, {"label": "D", "text": "Small intestine", "correct": false}], "correct_answer": "B. Antrum", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Antrum The given clinical scenario is suggestive of Zollinger-Ellison syndrome. In this condition, serum gastrin concentration is raised to around >1000 pg/ml. Gastrin is primarily secreted by G cells present in the antrum of the stomach.</p>\n<p><strong>Highyeild:</strong></p><p>Cell Type Part of stomach Secretion Stimulus for secretion Parietal cells Fundus, Body HCI Intrinsic factor Gastrin Vagal stimulation (Ach) Histamine Chief cells Fundus, Body Pepsinogen Gastric lipase Vagal stimulation Mucous cells Antrum, cardia, pylorus Mucous Vagal stimulation G cells Antrum Gastrin Vagal stimulation (via GRP) Oligopeptides Inhibited by somatostatin Inhibited by H + in stomach Enterochromaffin like cells (ECL) Fundus Histamine Gastrin</p>\n<p><strong>Extraedge:</strong></p><p>ZOLLINGER–ELLISON SYNDROME (ZES) Severe peptic ulcer diathesis secondary to gastric acid hypersecretion due to unregulated gastrin release from a non-β cell often well-differentiated neuroendocrine tumor ( gastrinoma ). ZOLLINGER–ELLISON SYNDROME (ZES) Triad:- Pancreatic or duodenal neuroendocrine tumor. Gastric acid hypersecretion. Peptic ulcer disease.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Examination of the properties of a normal sphincter in the digestive tract will show that:", "options": [{"label": "A", "text": "Primary flow across the sphincter is unidirectional", "correct": true}, {"label": "B", "text": "The lower esophageal sphincter is relaxed at the onset of a migrating motor complex in the stomach", "correct": false}, {"label": "C", "text": "Blockade of the sphincter innervation by a local anesthetic causes the sphincter to relax", "correct": false}, {"label": "D", "text": "The manometric pressure in the lumen of the sphincter is less than the pressure detected in the lumen on either side of the sphincter", "correct": false}], "correct_answer": "A. Primary flow across the sphincter is unidirectional", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Primary flow across the sphincter is unidirectional Primary flow across the sphincter is unidirectional the intrinsic and extrinsic sphincters operate together to permit the orderly flow of food into the stomach and to prevent the reflux of gastric contents into the esophagus the pyloric sphincter, prevents the reflux of duodenal contents into the stomach.</p>\n<p><strong>Highyeild:</strong></p><p>The upper esophageal sphincter (UES) maintains the highest resting pressure of all sphincters, preventing air from entering the esophagus. It consists of striated muscle, is under the control of the swallowing center in the medulla, and relaxes during swallowing to permit food to enter the esophagus. The lower esophageal sphincter (LES) separates the esophagus and the stomach. It consists of a special type of smooth muscle that relaxes during swallowing. The pyloric sphincter separates the stomach from the duodenum, and its resting pressure contributes to the regulation of gastric emptying and prevention of duodenal-gastric reflux.</p>\n<p><strong>Extraedge:</strong></p><p>An esophageal manometry test measures the motility and function of the esophagus and esophageal sphincter. The normal pressure of the lower esophageal sphincter (LES) is about 15 millimeters of mercury (mm Hg).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Slow waves are seen maximally in:", "options": [{"label": "A", "text": "Stomach", "correct": false}, {"label": "B", "text": "Ileum", "correct": true}, {"label": "C", "text": "Colon", "correct": false}, {"label": "D", "text": "Duodenum", "correct": false}], "correct_answer": "B. Ileum", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Ileum Slow waves are seen maximally in the ileum.</p>\n<p><strong>Highyeild:</strong></p><p>Slow Waves. Most gastrointestinal contractions occur rhythmically, and this rhythm is determined mainly by the frequency of so-called “slow waves” of smooth muscle membrane potential. These waves are not action potentials. Instead, they are slow, undulating changes in the resting membrane potential. Their intensity usually varies between 5 and 15 millivolts, and their frequency ranges in different parts of the human gastrointestinal tract from 3 to 12 per-minute, about 3 in the body of the stomach, as much as 12 in the duodenum, and about 8 or 9 in the terminal ileum. Therefore, the rhythm of contraction of the body of the stomach, the duodenum, and the ileum is usually about 3 per-minute, about 12 per-minute, and 8 to 9 per minute, respectively.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Stomach has at least 3-5 per-minute slow waves. Option C. Colon has 6-7 per-minute slow waves. Option D. Duodenum has 12 per minute slow waves.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Iron absorption takes place in which part of the intestine?", "options": [{"label": "A", "text": "Duodenum", "correct": true}, {"label": "B", "text": "Jejunum", "correct": false}, {"label": "C", "text": "Ileum", "correct": false}, {"label": "D", "text": "Sigmoid", "correct": false}], "correct_answer": "A. Duodenum", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Duodenum Iron absorption takes place in Duodenum.</p>\n<p><strong>Highyeild:</strong></p><p>Iron is absorbed from all parts of the small intestine, mostly by the following mechanism. The liver secretes moderate amounts of Apo transferrin into the bile, which flows through the bile duct into the duodenum. Here, Apo transferrin binds with free iron and also with certain iron compounds, such as hemoglobin and myoglobin from meat, two of the most important sources of iron in the diet. This combination is called transferrin. It, in turn, is attracted to and binds with receptors in the membranes of the intestinal epithelial cells. Then, by pinocytosis, the transferrin molecule, carrying its iron store, is absorbed into the epithelial cells and later released into the blood capillaries beneath these cells in the form of plasma transferrin. Iron absorption from the intestines is extremely slow, at a maximum rate of only a few milligrams per day. This slow rate of absorption means that even when tremendous quantities of iron are present in the food, only small proportions can be absorbed.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. Jejunum absorbs nutrients (vitamins, minerals, carbohydrates, fats, proteins) and water from food. Option C. Ileum; the ileum absorbs bile acids, fluid, and vitamin B-12. Finger-shaped structures called villi line the entire small intestine. It helps in the absorption of Option D. The main function of the sigmoid colon is to transport fecal matter from the descending colon to the rectum and anus.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Surgical removal of a part of the stomach results in disturbed absorption of vitamin B12, which is excreted with feces. The patient was diagnosed with anemia. What factor is necessary for the absorption of this vitamin?", "options": [{"label": "A", "text": "Gastrin", "correct": false}, {"label": "B", "text": "Folic Acid", "correct": false}, {"label": "C", "text": "Hydrochloric Acid", "correct": false}, {"label": "D", "text": "Gastro Mucoprotein", "correct": true}], "correct_answer": "D. Gastro Mucoprotein", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Gastro Mucoprotein The substance called intrinsic factor (Castle’s factor, gastro mucoprotein), essential for the absorption of vitamin B12 in the ileum, is secreted by the parietal cells of the stomach along with the secretion of hydrochloric acid.</p>\n<p><strong>Highyeild:</strong></p><p>When the acid-producing parietal cells of the stomach are destroyed, which frequently occurs in chronic gastritis, the person develops not only achlorhydria (lack of stomach acid secretion) but often also pernicious anemia because of failure of maturation of the red blood cells in the absence of vitamin B12 stimulation of the bone marrow.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest given options are not correct because the usual cause of vitamin B12 deficiency is not lack of this vitamin in the food but deficiency of formation of intrinsic factor, which is normally secreted by the parietal cells of the gastric glands and is essential for the absorption of vitamin B12 by the ileal mucosa. #EXTRAEDGE The major functions of vitamin B12 are: promotion of growth and promotion of red blood cell formation and maturation. Vitamin B12 Deficiency Causes Demyelination of the Large Nerve Fibers of the Spinal Cord. The demyelination of nerve fibers in people with vitamin B12 deficiency occurs especially in the posterior columns, and occasionally the lateral columns, of the spinal cord. As a result, many people with pernicious anemia have a loss of peripheral sensation and, in severe cases, even become paralyzed.</p>\n<p><strong>Extraedge:</strong></p><p>The major functions of vitamin B12 are: (1) promotion of growth and (2) promotion of red blood cell formation and maturation. Vitamin B12 Deficiency Causes Demyelination of the Large Nerve Fibers of the Spinal Cord. The demyelination of nerve fibers in people with vitamin B12 deficiency occurs especially in the posterior columns, and occasionally the lateral columns, of the spinal cord. As a result, many people with pernicious anemia have a loss of peripheral sensation and, in severe cases, even become paralyzed.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 18 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A 35-year-old came to Medicine OPD with complaints of lethargy, weight gain, and increased sleep. Investigations were done which revealed low TSH plasma concentration however, on administration of TRH, TSH was increased which of the following is likely to be present?", "options": [{"label": "A", "text": "Hyperthyroidism due to hypothalamus disease", "correct": false}, {"label": "B", "text": "Hyperthyroidism due to pituitary disease", "correct": false}, {"label": "C", "text": "Hypothyroidism due to disease in pituitary", "correct": false}, {"label": "D", "text": "Hypothyroidism due to disease in the hypothalamus", "correct": true}], "correct_answer": "D. Hypothyroidism due to disease in the hypothalamus", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Hypothyroidism due to disease in the hypothalamus The clinical history is suggestive of hypothyroidism due to low levels of TRH , which is due to the</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A: hyperthyroidism due to hypothalamus disease These patient presents will present with symptoms of hyperthyroidism Option B: hyperthyroidism due to pituitary disease In patients with primary disease in the pituitary, TRH does not elevate TSH levels Clinical history suggests hypothyroidism Option C: hypothyroidism due to disease in pituitary Decreasing levels of TSH reduced thyroid levels and patients with hypothyroidism but in patients with primary disease in the pituitary, TRH does not elevate TSH levels.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 29-year-old lady is diagnosed with Hashimoto thyroiditis and a positive antibody titer against thyroid oxidase enzyme. Which of the following is not a function of the affected enzyme?", "options": [{"label": "A", "text": "Coupling", "correct": false}, {"label": "B", "text": "Oxidation", "correct": false}, {"label": "C", "text": "Organification", "correct": false}, {"label": "D", "text": "Iodide trapping", "correct": true}], "correct_answer": "D. Iodide trapping", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Iodide trapping lodide trapping (iodide uptake) is not catalyzed by thyroid peroxidase. Oxidation, organification, and coupling are catalyzed by it.</p>\n<p><strong>Highyeild:</strong></p><p>Steps in synthesis and secretion of thyroid hormones:- lodide uptake: The basolateral sodium-iodide symporter (NIS) actively takes up I'(iodide) from the circulation into the follicular cells. It is then transported into the colloid through a pendrin (chloride-iodide) transporter Thyroglobulin synthesis: Thyroglobulin (Tg), is a large glycoprotein rich in tyrosine residues. It is synthesized by follicular cells. Iodination of thyroglobulin: This is regulated by the thyroid peroxidase (TO) enzyme. TPO has three functions: Oxidation: TPO oxidizes I- to I2 (iodine) in the presence of H202 Organification: TPO links tyrosine residues of thyroglobulin with iodine (l2) to form monoiodotyrosine (MIT), and diiodotyrosine (DIT) Coupling reactions: TPO combines iodinated tyrosine residues to make MIT + DIT = T3 (triiodothyronine). DIT + DIT = T4 (tetraiodothyronine) Storage: Thyroid hormones are bound to thyroglobulin and stored in the follicular lumen as colloids. The colloid has hormone reserves for 2-3 months. Release: Iodinated thyroglobulin is taken up by the thyroid follicles via endocytosis and fuses with lysosomes. It is cleaved by lysosomal proteolytic enzymes into MIT, DIT, T3, and T4. T4 (80%) and T3 (20%) are released into the blood.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Coupling reactions: TPO combines iodinated tyrosine residues to make MIT + DIT = T3 (triiodothyronine). DIT + DIT = T4 (tetraiodothyronine) Option B. Oxidation: TPO oxidizes I- to I2 (iodine) in the presence of H202 Option C. Organification: TPO links tyrosine residues of thyroglobulin with iodine (l2) to form monoiodotyrosine (MIT), diiodotyrosine (DIT).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Jitendra, a resident of Rajasthan present with hyperthyroidism and is planning for thyroidectomy. To achieve a euthyroid status preoperatively, he started on Lugol's iodine solution. Which of the following best describes its mechanism of action?", "options": [{"label": "A", "text": "Suppression of TSH secretion", "correct": false}, {"label": "B", "text": "Decreased iodination of MIT", "correct": false}, {"label": "C", "text": "Decreased T3 to T4 conversion", "correct": false}, {"label": "D", "text": "Inhibition of organification and synthesis of thyroid hormones", "correct": true}], "correct_answer": "D. Inhibition of organification and synthesis of thyroid hormones", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Inhibition of organification and synthesis of thyroid hormones The introduction of exogenous iodine in the form of Lugol's iodine solution leads to transient inhibition of organification and synthesis of thyroid hormones. This is known as the Wolff-chaikoff effect.</p>\n<p><strong>Highyeild:</strong></p><p>In individuals with a normal thyroid, the gland escapes from this inhibitory effect, and iodide organification resumes; but the suppressive action of high iodide may persist in patients with hyperthyroidism due to underlying autoimmune thyroid disease. The Jod-Basedow effect is iodine-induced hyperthyroidism, usually occurring after the use of an I-based contrast agent. It is often seen in of pre-existing thyroid conditions like multinodular</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Glucocorticoids appear to suppress the release of TSH from thyrotropes in a PKC-dependent manner through the protein annexin 1. Option B. T he process of iodide becoming incorporated into monoiodotyrosine (MIT) or diiodotyrosine (DIT) molecules are referred to as organification. Option C. T3 and T4 levels are too low, the pituitary gland will release more TSH.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following is false regarding thyroid hormone?", "options": [{"label": "A", "text": "T3 is more avidly bound to nuclear receptors than T4", "correct": false}, {"label": "B", "text": "T4 has more plasma concentration", "correct": false}, {"label": "C", "text": "T3 is more active than T4", "correct": false}, {"label": "D", "text": "T4 has a shorter half-life than T3", "correct": true}], "correct_answer": "D. T4 has a shorter half-life than T3", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>T4 has a shorter half-life than T3 T4 doesn't have a shorter half-life than T3, rather T3 has a shorter half-life and more rapid action than T4.</p>\n<p><strong>Highyeild:</strong></p><p>The table compares T4 and T3: T3 T4 More potent (4x) Less potent More active Less active Rapid onset of action Slow onset of action Shorter half-life (1 day) Longer half-life (7 days) Less plasma concentration More plasma concentration Less in colloid More in colloid Responsible for physiological actions Used for pharmacotherapy</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest Options are true as characteristics are mentioned in the High yield section.</p>\n<p><strong>Extraedge:</strong></p><p>The half-life of T4 is 6 - 7 days. T3 has a shorter half-life of 1 day.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Jitendra, a 15-year-old adolescent, is suspected of having anorexia nervosa. Thyroid function tests are also drawn. His TSH is in the normal range, but the rT3 level is elevated. Which of the following is the most accurate statement regarding her status?", "options": [{"label": "A", "text": "Reverse T3 has no biological effect", "correct": true}, {"label": "B", "text": "This patient probably has T3 thyroiditis", "correct": false}, {"label": "C", "text": "The free rT3 would be the next step to assess possible hyperthyroidism", "correct": false}, {"label": "D", "text": "This patient probably has hypothyroidism", "correct": false}], "correct_answer": "A. Reverse T3 has no biological effect", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Reverse T3 has no biological effect Reverse T3 has no biological effect. Individuals with anorexia nervosa often have an increased rT3 level and a lower T3 level, reflecting a lower metabolism rate as compensation for the markedly decreased caloric intake. The fact that hisTSH is in the normal range makes it difficult to make a diagnosis of hypothyroidism.</p>\n<p><strong>Highyeild:</strong></p><p>Thyroid hormone secretion requires the pinocytotic uptake and breakdown of colloids by follicular cells. TSH, which is secreted by the pituitary in response to thyrotropin-releasing hormone from the hypothalamus, simultaneously stimulates thyroid hormone synthesis and thyroid hormone secretion. The thyroid hormone exists in two forms: triiodothyronine (T3), and tetraiodothyronine (T4). Both circulate in the blood bound to plasma proteins, but at the cellular level, T4 is converted to T3, which then binds to thyroid hormone receptors. The thyroid hormone is essential for normal brain development in the perinatal period. The thyroid hormone stimulates oxidative metabolism in all tissues except the brain, spleen, and testis. ATP utilization and heat production is increased. The thyroid hormone binds to nuclear receptors to regulate the transcription of genes involved in metabolic events.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest Options are inappropriate because reverse T3 has no biological effect.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 41-year-old woman presents to her primary care physician with weight and hair loss, diarrhea, nervousness, and eye pressure. She has no medical problems, but some of her family members have similar symptoms and require medication. On examination, she is noted to have exophthalmos, an enlarged non tender goiter, hyperreflexia, and tremor when her arms are outstretched. The patient has a decreased thyroid-stimulating hormone (TSH) level and an increased free thyroxine (T4) level. What is the most probable diagnosis?", "options": [{"label": "A", "text": "Myasthenia Gravis", "correct": false}, {"label": "B", "text": "Graves disease", "correct": true}, {"label": "C", "text": "Primary Hypothyroidism", "correct": false}, {"label": "D", "text": "Secondary Hypothyroidism", "correct": false}], "correct_answer": "B. Graves disease", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Graves disease The patient has a decreased thyroid-stimulating hormone (TSH) level and an increased free thyroxine (T4) level and is diagnosed with Graves disease (hyperthyroidism). Clue in this case:- woman has weight and hair loss, diarrhea, nervousness, eye pressure, nontender goiter, exophthalmos, and laboratory evidence of hyperthyroidism .</p>\n<p><strong>Highyeild:</strong></p><p>High levels of iodine: Inhibit the iodine pump (Wolff-Chaikoff effect). Mechanism of action of PTU: Inhibits peroxidase enzyme activity in the follicular cell membrane, resulting in an inability to oxidize iodine. Effect of pregnancy on free thyroid levels: No change in free levels. The total level would be elevated because of an increase in thyroxine-binding Because the free levels remain the same, the patient is euthyroid.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Myasthenia gravis (MG) is an autoimmune disorder in which antibodies form against nicotinic acetylcholine (ACh) postsynaptic receptors at the neuromuscular junction (NMJ). Option C. & D are Hypothyroidism condition where the above case describes Hyperthyroidism.</p>\n<p><strong>Extraedge:</strong></p><p>Hypothyroidism is accompanied by slow thought processes and somnolence. Hyperthyroidism is characterized by nervousness, anxiety, paranoia, and difficulty in Fine muscle tremor also is prominent in hyperthyroidism.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 43-year-old female complains of weight loss, hyperhidrosis, low-grade fever, and increased irritability. She has been found to have hyperfunction of the sympathetic-adrenal system and basal metabolism. These disorders can be caused by hypersecretion of the following hormone?", "options": [{"label": "A", "text": "Corticotropin", "correct": false}, {"label": "B", "text": "Somatotropin", "correct": false}, {"label": "C", "text": "Aldosterone", "correct": false}, {"label": "D", "text": "Thyroxine", "correct": true}], "correct_answer": "D. Thyroxine", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Thyroxine The complaints of that patient – weight loss, hyperhidrosis, low-grade fever, increased irritability, and the increase in basal metabolic rate are the symptoms of hypersecretion of thyroid hormones (hyperthyroidism).</p>\n<p><strong>Highyeild:</strong></p><p>Hypothyroidism is accompanied by slow thought processes and somnolence. Hyperthyroidism is characterized by nervousness, anxiety, paranoia, and difficulty Fine muscle tremor also is prominent in hyperthyroidism.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. High Corticotropin causes include adrenal adenoma, adrenal carcinoma, and adrenal hyperplasia. Option B. Somatotropin; In adults, too much GH production: Pituitary tumors. Most acromegaly cases are caused by a noncancerous (benign) tumor (adenoma) of the pituitary gland. Option C. Hyperaldosteronism occurs when the adrenal glands release too much aldosterone.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 26-year-old pregnant woman and her 3-year-old child are seen in a medical camp in Himachal Pradesh. The child is short in stature, has a potbelly, enlarged protruding tongue, and is developmentally delayed. Iodine is prescribed for mother and child, with the hope of preventing mental retardation in the developing fetus. Iodides are stored in the thyroid follicles mainly in the form of which of the following?", "options": [{"label": "A", "text": "Monoiodotyrosine", "correct": false}, {"label": "B", "text": "Thyroglobulin", "correct": true}, {"label": "C", "text": "Thyroid peroxidase", "correct": false}, {"label": "D", "text": "Thyroxine", "correct": false}], "correct_answer": "B. Thyroglobulin", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Thyroglobulin The thyroid gland stores iodide primarily as thyroglobulin.</p>\n<p><strong>Highyeild:</strong></p><p>The thyroid gland has a specialized active transport system that very efficiently traps iodide from circulating blood and can accumulate iodide against a large concentration gradient. Within the thyroid, the iodide rapidly undergoes organification by which it is oxidized and covalently linked to tyrosine residues in thyroglobulin.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- D: The iodinated tyrosine residues gradually become coupled to form thyroxine (I4), the major secretion product of the thyroid. A: Monoiodotyrosine is not secreted; it is a precursor of T3 and I4. C: Thyroid peroxidase is a catalytic enzyme involved in the peroxidation, iodination, and coupling of the iodo tyrosyl residues. Worldwide, congenital hypothyroidism is one of the most common causes of preventable mental retardation .</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "All the following are functions of thyroid cells except:", "options": [{"label": "A", "text": "Collect and transport Iodine", "correct": false}, {"label": "B", "text": "Synthesises thyroglobulin", "correct": false}, {"label": "C", "text": "Secrete the thyroid hormones", "correct": false}, {"label": "D", "text": "Synthesises thyroid hormones", "correct": true}], "correct_answer": "D. Synthesises thyroid hormones", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Synthesises thyroid hormones Thyroid hormone synthesis takes place in the follicular cells of the thyroid gland. The whole process involves an intact and coordinated synthesis pathway containing sodium iodide symporter (NIS), thyroperoxidase (TPO), thyroglobulin, and adequate dietary iodide.</p>\n<p><strong>Highyeild:</strong></p><p>At the interface between the thyrocyte and the colloid, iodide undergoes a process referred to as organification. First, it is oxidized to iodine and then incorporated into the carbon 3 position of tyrosine residues that are part of the thyroglobulin molecule in the colloid. Thyroglobulin is synthesized in the thyroid cells and secreted into the colloid by exocytosis of granules. The oxidation and reaction of iodide with the secreted thyroglobulin are mediated by thyroid peroxidase, a membrane-bound enzyme found in the thyrocyte apical membrane. The thyroid hormones so produced remain part of the thyroglobulin molecule until needed. As such, colloid represents a reservoir of thyroid hormones. When there is a need for thyroid hormone secretion, the colloid is internalized by the thyrocytes by endocytosis, and directed toward lysosomal degradation. Thyrocytes thus have four functions: They collect and transport iodine, they synthesize thyroglobulin and secrete it into the colloid, they fix iodine to the thyroglobulin to generate thyroid hormones, and they remove the thyroid hormones from thyroglobulin and secrete them into the circulation.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Functions of thyroid cells:- Option A. Collect and transport Iodine Option B. Synthesises thyroglobulin Option C. Secrete the thyroid hormones</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "In the thyroid, ‘coupling reaction’ forms all the following except:", "options": [{"label": "A", "text": "T3", "correct": false}, {"label": "B", "text": "T4", "correct": false}, {"label": "C", "text": "rT3", "correct": false}, {"label": "D", "text": "DIT", "correct": true}], "correct_answer": "D. DIT", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>DIT In Coupling reactions T3, T4 and rT3 form with the help of MIT and DIT. Coupling reactions: TPO combines iodinated tyrosine residues to make MIT + DIT = T3 (triiodothyronine). DIT + DIT = T4 (tetraiodothyronine)</p>\n<p><strong>Highyeild:</strong></p><p>Steps in synthesis and secretion of thyroid hormones:- lodide uptake: The basolateral sodium-iodide symporter (NIS) actively takes up I'(iodide) from the circulation into the follicular cells. It is then transported into the colloid through a pendrin (chloride-iodide) transporter Thyroglobulin synthesis: Thyroglobulin (Tg), is a large glycoprotein rich in tyrosine residues. It is synthesized by follicular cells. iodination of thyroglobulin: This is regulated by the thyroid peroxidase (TO) enzyme. TPO has three functions: Oxidation: TPO oxidizes I- to I2 (iodine) in the presence of H202 Organification: TPO links tyrosine residues of thyroglobulin with iodine (l2) to form monoiodotyrosine (MIT), diiodotyrosine (DIT) Coupling reactions: TPO combines iodinated tyrosine residues to make MIT + DIT = T3 (triiodothyronine). DIT + DIT = T4 (tetraiodothyronine) Storage: Thyroid hormones are bound to thyroglobulin and stored in the follicular lumen as colloids. The colloid has hormone reserves for 2-3 months Release: Iodinated thyroglobulin is taken up by the thyroid follicles via endocytosis and fuses with lysosomes. It is cleaved by lysosomal proteolytic enzymes into MIT, DIT, T3, and T4. T4 (80%) and T3 (20%) are released into the blood.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. The major hormonal product of the coupling reaction is the molecule thyroxine (T4), which is formed when two molecules of diiodotyrosine are joined together; the thyroxine then remains part of the thyroglobulin molecule. Option B. One molecule of monoiodotyrosine couples with one molecule of diiodotyrosine to form triiodothyronine (T3), which represents about one-fifteenth of the final hormones. Option C. Small amounts of reverse T3 (rT3) are formed by the coupling of diiodotyrosine with monoiodotyrosine , but RT3 does not appear to be of functional significance in humans.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 20 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A 49-year-old male with end-stage renal failure is able to perform peritoneal dialysis at home. The osmolality of the solution chosen for peritoneal dialysis will determine the rate of ultrafiltration. Which of the following statements best characterizes a molecule whose osmolality is zero?", "options": [{"label": "A", "text": "It will not permeate the membrane", "correct": false}, {"label": "B", "text": "It can only cross the membrane through the lipid bilayer", "correct": false}, {"label": "C", "text": "It causes water to flow across the membrane", "correct": false}, {"label": "D", "text": "It is as diffusible through the membrane as water", "correct": true}], "correct_answer": "D. It is as diffusible through the membrane as water", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>It is as diffusible through the membrane as water A molecule with an osmolality of zero means that it does not exert any osmotic pressure and does not cause water to flow across the membrane. Therefore, the correct answer is: \"It is as diffusible through the membrane as water.\"</p>\n<p><strong>Highyeild:</strong></p><p>The osmolality of a substance i s the number of osmoles per kg of solvent. One osmole (Osm) equals the gram molecular weight of a substance divided by the number of free-moving particles that each molecule liberates in solution. Osmotically active substances in the body are dissolved in water, and the density of water is 1. Thus, osmolar concentrations can be expressed as osmoles (or milliosmoles) per liter of water. If the osmolality is zero, there are no free-moving particles, and thus, the molecule is as diffusible as water through the membrane.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Molecules with a low molecular weight, small size, and high diffusibility are preferred in dialysis solutions because they can pass through the semipermeable membrane easily and efficiently. In contrast, molecules that are too large or have low diffusibility may not be effectively removed by peritoneal dialysis.</p>\n<p><strong>Extraedge:</strong></p><p>A. The rate of is diffusion directly proportional to:- Concentration gradient. Solubility in the membrane. Temperature. The surface area of the membrane B. The rate of diffusion is inversely proportional with: The molecular weight of the diffusible substance. The thickness of the membrane</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Jitendra was bitten by a dog 2 days back and now presents with fever, hydrophobia, and salivation from the mouth. What is the mechanism by which the disease spreads?", "options": [{"label": "A", "text": "Facilitated diffusion", "correct": false}, {"label": "B", "text": "Simple diffusion", "correct": false}, {"label": "C", "text": "Primary active transport", "correct": true}, {"label": "D", "text": "Second active transport", "correct": false}], "correct_answer": "C. Primary active transport", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Primary active transport The clinical scenario is of rabies and virus spread by binding to acetylcholine nicotinamide receptor on the axon. It is vesicular transport.</p>\n<p><strong>Highyeild:</strong></p><p>The mechanism of action of rabies The fusion of the rabies virus envelope to the host cell membrane (adsorption) initiates the infection process. The interaction of the G protein and specific cell surface receptors may be involved. After adsorption, the virus penetrates the host cell and enters the cytoplasm.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Facilitated diffusion. To increase the rate of transport, carrier or transporters are used . Option B Simple diffusion does not follow saturation kinetics. Option D Secondary active transport, Indirect use via pumps. Active transport is against the gradient and requires energy.</p>\n<p><strong>Extraedge:</strong></p><p>Primary active transport is the transport of molecules against a concentration gradient by the use of energy from ATP Secondary active transport is the transport two different molecules across a transport membrane using energy in other forms than ATP A single molecule is transported Two types of molecules are transported at once Uses energy from ATP Concentration gradient of the driving ion provides the energy for the transport of driven ion/molecule against its concentration gradient Ions like sodium, potassium, and calcium are transported across the cell membrane Ions serve as driving molecules, while ions or other molecules serve as driven molecules Transmembrane proteins are unique to the ion transported through them Symports and antiports are the two types of transmembrane proteins Sodium-potassium pump, calcium pump in the muscles, and proton pump in the stomach are examples Glucose-sodium pump, Na+/Ca2+ exchanger, and sodium/phosphate cotransporter are examples</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 55-year-old smoker having difficulty in breathing was diagnosed with pulmonary lung fibrosis with a saturation of 89%. The cause of this reduced saturation is a defect in which mechanism?", "options": [{"label": "A", "text": "Facilitated diffusion", "correct": false}, {"label": "B", "text": "Simple diffusion", "correct": true}, {"label": "C", "text": "Primary active transport", "correct": false}, {"label": "D", "text": "Second active transport", "correct": false}], "correct_answer": "B. Simple diffusion", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Simple diffusion Pulmonary lung fibrosis causes a reduction in diffusion across members and therefore there is a reduction in oxygen saturation.</p>\n<p><strong>Highyeild:</strong></p><p>Pulmonary fibrosis leads to a decrease in oxygen diffusion, in particular during exercise. Bronchial obstruction also could decrease the partial pressure of oxygen (P(a)O(2)). The most common signs and symptoms of idiopathic pulmonary fibrosis are shortness of breath and a persistent dry, hacking cough. Many affected individuals also experience a loss of appetite and gradual weight loss.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options: Option A: To increase the rate of transport, carriers or transporters are used. Option C: Direct use of ATPs. Option D: Secondary active transport, Indirect use via pumps. Active transport is against gradients and requires energy.</p>\n<p><strong>Extraedge:</strong></p><p>Simple diffusion is an unassisted type of diffusion in which a particle moves from higher to a lower concentration Facilitated diffusion is the transport of substances across a biological membrane through a concentration gradient by means of a carrier molecule Occurs through the phospholipid bilayer Occurs through transmembrane proteins Transports small, non-polar particles Transports large or polar particles Occurs directly through the cell membrane Occurs through specific facilitator molecules Rate of diffusion is directly proportional to the concentration gradient and the membrane permeability of the solute molecule Rate of diffusion depends on the kinetics of carrier- mediated transport Examples: Diffusion of gases across the respiratory membrane, diffusion of molecules from the blood to the cells through the interstitial fluid Examples: Counter-transport of chloride/bicarbonate in renal tubular cells, cotransport of sodium with sugars like glucose, galactose,etc.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "An obese patient consulting a nutritionist has advised a calorie-deficit diet. The patient was concerned about not getting enough energy. The patient was explained that the required amount of glucose is mentioned in the diet as glucose follows ___ mechanism:", "options": [{"label": "A", "text": "Facilitated diffusion", "correct": true}, {"label": "B", "text": "Simple diffusion", "correct": false}, {"label": "C", "text": "Primary active transport", "correct": false}, {"label": "D", "text": "Second active transport", "correct": false}], "correct_answer": "A. Facilitated diffusion", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Facilitated diffusion To increase the rate of transport, carriers or transporters are used. Glucose is transported via GLUT receptors. It follows saturation kinetics.</p>\n<p><strong>Highyeild:</strong></p><p>Since glucose is a large molecule, its diffusion across a membrane is difficult. Hence, it diffuses across membranes through facilitated diffusion, down the concentration gradient. The carrier protein at the membrane binds to the glucose and alters its shape such that it can easily be transported.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B: Simple diffusion does not follow saturation kinetics. Option C: Direct use of ATPs. Option D: Secondary active transport, Indirect use via pumps. Active transport is against gradients and requires energy.</p>\n<p><strong>Extraedge:</strong></p><p>Simple diffusion is an unassisted type of diffusion in which a particle moves from higher to a lower concentration Facilitated diffusion is the transport of substances across a biological membrane through a concentration gradient by means of a carrier molecule Occurs through the phospholipid bilayer Occurs through transmembrane proteins Transports small, non-polar particles Transports large or polar particles Occurs directly through the cell membrane Occurs through specific facilitator molecules Rate of diffusion is directly proportional to the concentration gradient and the membrane permeability of the solute molecule Rate of diffusion depends on the kinetics of carrier- mediated transport Examples: Diffusion of gases across the respiratory membrane, diffusion of molecules from the blood to the cells through the interstitial fluid Examples: Counter-transport of chloride/bicarbonate in renal tubular cells, cotransport of sodium with sugars like glucose, galactose,etc.</p>\n<p><strong>Table:</strong></p><p>Simple or passive diffusion Facilitated diffusion Diffusion is unassisted Diffusion is assisted by carrier proteins Occurs through the lipid bilayer of cell membrane Occurs through the transmembrane proteins Only small molecules and non polar molecules are transported Large and polar molecules are transported Rate of diffusion is directly proportional to the concentration\n gradient and membrane permeability of the solute molecule Rate of diffusion depends on the rate at which carrier proteins\n transport the molecules</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "In a medical college, research was being done on obesity. It was shown that on giving insulin the transport of D-glucose across the plasma membrane of adipose tissue is much faster than the transport of L-glucose. Which of the following options explains this concept?", "options": [{"label": "A", "text": "Carrier-mediated transport of glucose", "correct": true}, {"label": "B", "text": "Simple diffusion of glucose", "correct": false}, {"label": "C", "text": "Primary active transport of glucose", "correct": false}, {"label": "D", "text": "None of the above", "correct": false}], "correct_answer": "A. Carrier-mediated transport of glucose", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Carrier-mediated transport of glucose Glucose transport across the membranes of adipose tissue is mediated by transporters called GLUT4. These are the carrier proteins. These have specificity and have stereo selectivity for D-glucose. So option A is true</p>\n<p><strong>Highyeild:</strong></p><p>Different types of GLUT Transporter Tissues Function GLUT 1 All tissues, especially red cells, brain Basal uptake of glucose; transport across the blood-brain barrier GLUT 2 Beta cells of pancreas; liver, kidney; gut Regulation of insulin release, other aspects of glucose homeostasis GLUT 3 Brain, kidney, placenta, other tissues Uptake into neurons, other tissues GLUT 4 Muscle, adipose Insulin-mediated uptake of glucose GLUT 5 Gut, kidney Absorption of fructose</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. Glucose molecules have a large size, so they can’t be transported through cell membranes through simple diffusion. So option B is false Option C. Primary active transport of glucose occurs in the gut and not in the adipose tissue so option C is false.</p>\n<p><strong>Extraedge:</strong></p><p>GLUT4 is one of the most important downstream sites of the insulin receptor because it sits at the rate-limiting step in the insulin transduction signal pathway. GLUT4, unlike other facilitative GLUTs, is primarily localized intracellularly in the unstimulated state and is acutely redistributed to the plasma membrane in response to insulin and other stimuli.</p>\n<p><strong>Table:</strong></p><p>Simple or passive diffusion Facilitated diffusion Diffusion is unassisted Diffusion is assisted by carrier proteins Occurs through the lipid bilayer of cell membrane Occurs through the transmembrane proteins Only small molecules and non polar molecules are transported Large and polar molecules are transported Rate of diffusion is directly proportional to the concentration\n gradient and membrane permeability of the solute molecule Rate of diffusion depends on the rate at which carrier proteins\n transport the molecules</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 36-year-old woman visits the hospital complaining that abdominal pain occurs after she eats. She says it has been almost 1 month. Endoscopy was done and it came out to be a peptic ulcer. The doctor prescribed her to take Omeprazole before eating. The type of cell membrane transport will be inhibited by the medicine?", "options": [{"label": "A", "text": "Osmosis", "correct": false}, {"label": "B", "text": "Primary active transport", "correct": true}, {"label": "C", "text": "Secondary active transport", "correct": false}, {"label": "D", "text": "Simple diffusion", "correct": false}], "correct_answer": "B. Primary active transport", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Primary active transport Proton pump inhibitors inhibit the proton pump (H+/K+ -ATPase) and reduce acid production. It is the primary active transport mechanism since it requires ATP to move ions against their electrochemical gradients. So, option B is correct.</p>\n<p><strong>Highyeild:</strong></p><p>Primary active transport, also called direct active transport, directly uses chemical energy (such as from adenosine triphosphate or ATP in the case of the cell membrane) to transport all species of solutes across a membrane against their concentration gradient.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Options A & D: whereas osmosis and simple diffusion are passive transport with no requirement of ATP. Option C: Secondary transport utilizes energy stored in an electrochemical gradient to cotransport the substance.</p>\n<p><strong>Table:</strong></p><p>Simple or passive diffusion Facilitated diffusion Diffusion is unassisted Diffusion is assisted by carrier proteins Occurs through the lipid bilayer of cell membrane Occurs through the transmembrane proteins Only small molecules and non polar molecules are transported Large and polar molecules are transported Rate of diffusion is directly proportional to the concentration\n gradient and membrane permeability of the solute molecule Rate of diffusion depends on the rate at which carrier proteins\n transport the molecules</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "What type of membrane protein selectively moves a polar substance or ion through a plasma membrane without the use of a pore:", "options": [{"label": "A", "text": "Enzyme", "correct": false}, {"label": "B", "text": "Carrier protein", "correct": true}, {"label": "C", "text": "Linker protein", "correct": false}, {"label": "D", "text": "Ion channel", "correct": false}], "correct_answer": "B. Carrier protein", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Carrier protein Many of the integral proteins provide structural channels (or pores) through which water molecules and water-soluble substances, especially ions, can diffuse between the extracellular and intracellular fluids. These protein channels also have selective properties that allow preferential diffusion of some substances over others. Other integral proteins act as carrier proteins for transporting substances that otherwise could not penetrate the lipid bilayer. A notable example is GLUT: These are carrier proteins that transport glucose in the direction of a concentration gradient.</p>\n<p><strong>Highyeild:</strong></p><p>Carrier proteins bind to the substances they transport across the membrane via facilitated diffusion, whereas channel proteins provide a pore for substances to move across the membrane via facilitated diffusion.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Membrane proteins are enzymes, which catalyze chemical reactions and thus have domains that are specialized for catalysis. Option C. Plasma membrane of eukaryotic cells is connected to the underlying cytoskeleton via linking proteins such as Ezrin, Radixin, and Moesin (ERM) and myosin 1 proteins. Option D. Ion channels are protein molecules that span across the cell membrane allowing the passage of ions from one side of the membrane to the othe</p>\n<p><strong>Extraedge:</strong></p><p>Different types of GLUT Transporter Tissues Function GLUT 1 All tissues, especially red cells, brain Basal uptake of glucose; transport across the blood-brain barrier GLUT 2 Beta cells of pancreas; liver, kidney; gut Regulation of insulin release, other aspects of glucose homeostasis GLUT 3 Brain, kidney, placenta, other tissues Uptake into neurons, other tissues GLUT 4 Muscle, adipose Insulin-mediated uptake of glucose GLUT 5 Gut, kidney Absorption of fructose</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 17 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A small calcium binding protein that modifies the activity of many enzymes and other proteins in response to changes of calcium concentration, is known as:", "options": [{"label": "A", "text": "Cyclin", "correct": false}, {"label": "B", "text": "Calmodulin", "correct": true}, {"label": "C", "text": "Collagen", "correct": false}, {"label": "D", "text": "Kinesin", "correct": false}], "correct_answer": "B. Calmodulin", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Calmodulin Calmodulin is a Ca2+-binding protein ubiquitous in the eukaryotes.</p>\n<p><strong>Highyeild:</strong></p><p>It has no intrinsic enzymatic activity, but it regulates a wide spectrum of enzymes that control many basic cellular processes, ranging from the metabolism of cyclic nucleotides, Ca2+, and glycogen to contractile activity and stimulus-secretion coupling. Smooth muscle cells contain large amounts of this regulatory protein. Although this protein is similar to troponin, it is different in the manner in which it initiates contraction. Calmodulin initiates contraction by activating the myosin cross-bridges. This activation and subsequent Contraction occur in the following sequence:- Calcium concentration in the cytosolic fluid of the smooth muscle increases as a result of the influx of calcium from the extracellular fluid through calcium channels and/or release of calcium from the sarcoplasmic reticulum. The calcium ions bind reversibly with calmodulin. The calmodulin-calcium complex then joins with and activates myosin light chain kinase, a phosphorylating enzyme.</p>\n<p><strong>Random:</strong></p><p>Explanation for incorrect Option: - Option: A . Cyclins are eukaryotic proteins that play an active role in controlling nuclear cell division cycles. , and regulate cyclin dependent kinases (CDKs). Option: C . Membrane collagenous proteins function both as cell surface receptors and as soluble extracellular molecules because their ectodomains are released from the cell surface by shedding. Option: D . Kinesins are biological motor proteins that are ATP-dependent and function to assist cells with the transport of molecules along microtubules.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Solutes can be reabsorbed by active transport or by passive transport in the tubule. Reabsorption of water is always carried by passive transport by osmosis. Select the justified statements concerning reabsorption of glucose by the renal tubule?", "options": [{"label": "A", "text": "Primary active transport", "correct": false}, {"label": "B", "text": "Secondary active transport", "correct": false}, {"label": "C", "text": "Transport coupled indirectly to an ion gradient for source of energy", "correct": false}, {"label": "D", "text": "Both B and C", "correct": true}], "correct_answer": "D. Both B and C", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Both B and C Secondary active transport is coupled indirectly to an energy source, such as that due to an ion gradient, is referred to as secondary active transport. Reabsorption of glucose by the renal tubule is an example of secondary active transport. Although solutes can be reabsorbed by active and/or passive mechanisms by the tubule, water is always reabsorbed passively across the tubular epithelial membrane by the process of osmosis</p>\n<p><strong>Highyeild:</strong></p><p>Primary active transport Active transport can move a solute against an electrochemical gradient; this requires energy derived from metabolism. Transport that is coupled directly to an energy source, such as the hydrolysis of adenosine triphosphate (ATP), is termed primary active transport. An example of this mechanism is the sodium-potassium adenosine triphosphatase (ATPase) pump (Na+-K+ ATPase pump) that functions throughout most parts of the renal tubule.</p>\n<p><strong>Random:</strong></p><p>Explanation for incorrect Option: - Option: A. Primary active transport are explained in the high yield section.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Active transport requires energy for the movement of molecules whereas passive transport does not require energy for the movement of molecules. In active transport, the molecules move against the concentration gradient. Image depicts the features. Select the justifications for glucose transport in the renal tubule?", "options": [{"label": "A", "text": "Transport that is coupled directly to an energy source, such as the hydrolysis of adenosine triphosphate (ATP),", "correct": false}, {"label": "B", "text": "Transport that is coupled indirectly to an energy source, such as that due to an ion gradient", "correct": false}, {"label": "C", "text": "Two or more substances interact with a specific membrane protein and are transported together across the membrane.", "correct": false}, {"label": "D", "text": "Both B and C justified", "correct": true}], "correct_answer": "D. Both B and C justified", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683533889142-QTDY040003IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Both B and C justified The image shows secondary active transport of glucose and amino acids in the proximal tubule. In both cases, specific carrier proteins in the brush border combine with a sodium ion and an amino acid or a glucose molecule at the same time.</p>\n<p><strong>Highyeild:</strong></p><p>These transport mechanisms are so efficient that they remove virtually all the glucose and amino acids from the tubular lumen After entry into the cell, glucose and amino acids exit across the basolateral membranes by diffusion, driven by the high glucose and amino acid concentrations in the cell facilitated by specific transport proteins.</p>\n<p><strong>Random:</strong></p><p>Explanation for incorrect Option: - Option: A. Transport that is coupled directly to an energy source, such as the hydrolysis of adenosine triphosphate (ATP). This activity is called primary active transport.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Reabsorption of glucose in the renal tubule occurs in the proximal convoluted tubule. It is reabsorbed by active transport. Select the incorrect statement?", "options": [{"label": "A", "text": "Glucose, amino acids, and bicarbonate are reabsorbed along with Na+ in the early portion of the proximal tubule", "correct": false}, {"label": "B", "text": "Glucose is removed from filtrate by secondary active transport at rate of 100 mg/min", "correct": false}, {"label": "C", "text": "All of the glucose is reabsorbed by cells of PCT", "correct": false}, {"label": "D", "text": "Nearly 20 mg appear in the urine per 24 h", "correct": true}], "correct_answer": "D. Nearly 20 mg appear in the urine per 24 h", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Nearly 20 mg appear in the urine per 24 h Essentially all of the glucose is reabsorbed, and no more than a few milligrams appear in the urine per 24 hrs.</p>\n<p><strong>Highyeild:</strong></p><p>The amount reabsorbed is proportional to the amount filtered and hence to the plasma glucose level (PG) times the GFR up to the transport maximum (TmG). When the TmG is exceeded, the amount of glucose in the urine rises. The TmG is about 375 mg/min in men and 300 mg/min in women.</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Option: - Option: A. Glucose, amino acids, and bicarbonate are reabsorbed along with Na+ in the early portion of the proximal tubule. Option: B. Glucose is removed from filtrate by secondary active transport at a rate of 100 mg/min. Option: C. All of the glucose is reabsorbed by cells of PCT.</p>\n<p><strong>Extraedge:</strong></p><p>Glucose, amino acids, and bicarbonate are reabsorbed along with Na+ in the early portion of the proximal tubule. Glucose is typical of substances removed from the urine by secondary active transport. It is filtered at a rate of approximately 100 mg/min (80 mg/dL of plasma × 125 mL/min).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Image is provided below. It depicts a clear relation between the plasma glucose level (PG) and amount of glucose reabsorbed (TG). Select the best possible explanations to obtain the “ideal curve” shown in the image?", "options": [{"label": "A", "text": "When transport maximum (tmg) of glucose in all the tubules was identical", "correct": false}, {"label": "B", "text": "Provided all the glucose was removed from each tubule when the amount filtered was below the tmg", "correct": false}, {"label": "C", "text": "Both A and B explanations improper", "correct": false}, {"label": "D", "text": "Both A and B explanation best suited", "correct": true}], "correct_answer": "D. Both A and B explanation best suited", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683533889224-QTDY040005IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Both A and B explanation best suited The image shown above describes the relation between the plasma glucose level (PG) and amount of glucose reabsorbed (TG).</p>\n<p><strong>Highyeild:</strong></p><p>As the plasma glucose level increases, the reabsorption of glucose by renal tubule is increased. The transport maximum (TmG), refers to the point at which an increase in concentration of a substance does not result in an increase in movement of a substance across a cell membrane. The TmG is about 375 mg/min in healthy individuals. Further rise in plasma glucose level would result in passing glucose in urine called glycosuria.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Glucose reabsorption in nephrons is similar to glucose reabsorption in the mucosal cells in the intestine. Glucose and Na+ together bind with sodium-dependent glucose transporter (SGLT)-2 in the apical membrane. Select the best possible explanations for the above statement?", "options": [{"label": "A", "text": "Sodium-dependent glucose transporter (SGLT)-2 binds with D-glucose", "correct": false}, {"label": "B", "text": "Transport of D-glucose many times higher than transport of L-glucose.", "correct": false}, {"label": "C", "text": "Plant glucoside, phlorizin inhibits glucose transport in the kidneys and intestine", "correct": false}, {"label": "D", "text": "All best possible explanations", "correct": true}], "correct_answer": "D. All best possible explanations", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>All best possible explanations Glucose reabsorption in the kidneys is similar to glucose reabsorption in the intestine. Glucose and Na+ bind to the sodium-dependent glucose transporter (SGLT)-2 in the apical membrane, and glucose is carried into the cell as Na+ moves down its electrical and chemical gradient.</p>\n<p><strong>Highyeild:</strong></p><p>The Na+ is then pumped out of the cell into the interstitium, and the glucose exits by facilitated diffusion via glucose transporter (GLUT)-2 into the interstitial fluid. At least in the rat, there is some transport by SGLT-1 and GLUT-1 as well. SGLT-2 specifically binds the D isomer of glucose, and the rate of transport of D-glucose is many times greater than that of L-glucose. Glucose transport in the kidneys is inhibited, as it is in the intestine, by the plant glucoside phlorizin, which competes with D-glucose for binding to the carrier.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Male person of age 24 years reported frequent passing urine. His weight is 275 lb, and height is 5 ft 11inch. The 24-hr creatinine clearance reported his GFR as 150 ml/min. The plasma glucose level is 300 mg/100ml. Considering the transport maximum for glucose as normal, Select the rate of urinary glucose excretion?", "options": [{"label": "A", "text": "0 mg/min", "correct": false}, {"label": "B", "text": "100 mg/min", "correct": false}, {"label": "C", "text": "150 mg/min", "correct": true}, {"label": "D", "text": "215 mg/min", "correct": false}], "correct_answer": "C. 150 mg/min", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>150 mg/min The filtered load of glucose can be determined as GFR (150 ml/min) × plasma glucose (300 mg/dL) = 450 mg/min. The transport maximum for glucose in this example is 300 mg/min. Therefore, the maximum rate of glucose reabsorption is 300 mg/min. The urinary glucose excretion is equal to the filtered load (450 mg/min) minus the tubular reabsorption of glucose (300 mg/min), or 150 mg/min.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "All of the following statements are correct about potassium balance except:-", "options": [{"label": "A", "text": "Most of potassium is intracellular", "correct": false}, {"label": "B", "text": "Three-fourths of the total body potassium is found in skeletal muscle", "correct": false}, {"label": "C", "text": "Intracellular potassium is released into extracellular space in response to severe injury", "correct": false}, {"label": "D", "text": "Acidosis leads to movement of potassium from extracellular to intracellular fluid compartment", "correct": true}], "correct_answer": "D. Acidosis leads to movement of potassium from extracellular to intracellular fluid compartment", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Acidosis leads to movement of potassium from extracellular to intracellular fluid compartment</p>\n<p><strong>Highyeild:</strong></p><p>Acid-Base Abnormalities Can Cause Changes in Potassium Distribution.Metabolic acidosis increases extracellular potassium concentration, in part by causing loss of potassium from the cells, whereas metabolic alkalosis decreases extracellular fluid potassium concentration.</p>\n<p><strong>Random:</strong></p><p>Explanation for incorrect Option: - Option: A. more than 98 percent of the total body potassium is contained in the cells and only 2 percent is contained in the extracellular fluid. Option: B. Potassium is the predominant intracellular cation, and approximately 60% of total body potassium is concentrated in skeletal muscle. Option: C. Cell Lysis Causes Increased Extracellular Potassium Concentration. As cells are destroyed, the large amounts of potassium contained in the cells are released into the extracellular compartment. This release of potassium can cause significant hyperkalemia if large amounts of tissue are destroyed, as occurs with severe muscle injury or with red blood cell lysis.</p>\n<p><strong>Extraedge:</strong></p><p>Secretion of acid and reabsorption of filtered bicarbonate by proximal tubular cells in the kidney. H+ is transported into the tubular lumen by NHE3 in exchange for Na+. Active transport by Na, K ATPase is indicated by arrows.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following causes the rate of diffusion of a particle across a membrane to increase?", "options": [{"label": "A", "text": "The area of the membrane increases", "correct": true}, {"label": "B", "text": "The thickness of the membrane increases", "correct": false}, {"label": "C", "text": "The size of the particle increases", "correct": false}, {"label": "D", "text": "The concentration gradient of the particle decreases", "correct": false}], "correct_answer": "A. The area of the membrane increases", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The area of the membrane increases The rate of diffusion is described by Fick’s law, which states that the flux of material across a membrane is directly proportional to the area of a membrane, the concentration difference of the particles on either side of the membrane, and the lipid solubility of the particle.</p>\n<p><strong>Highyeild:</strong></p><p>Fick's laws of diffusion states that the rate at which a molecule moves through a material is proportional to the concentration gradient (the difference in concentrations) between the two ends of the material; and inversely proportional to the thickness of the membrane. Net flux is inversely proportional to the thickness of the membrane and the size (specifically, the square root of the gram molecular weight) of the substance.</p>\n<p><strong>Random:</strong></p><p>Explanation for incorrect Option: - Option: B. Increased surface area increases the rate of diffusion, whereas a thicker membrane reduces it. Option: C. The rate of diffusion is inversely proportional to the size of the molecules. This means that the smaller the size of the molecule, the higher is the rate of diffusion. Option: D. The rate of diffusion is directly proportional to the concentration gradient. Higher the concentration gradient, the faster the rate of diffusion.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following is true about cell membrane transport ?", "options": [{"label": "A", "text": "Cl- with glucose symport", "correct": false}, {"label": "B", "text": "Na+ with glucose antiport", "correct": false}, {"label": "C", "text": "Na+ with glucose symport", "correct": true}, {"label": "D", "text": "K+ with glucose symport", "correct": false}], "correct_answer": "C. Na+ with glucose symport", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Na+ with glucose symport The transport of most hexoses is dependent on Na+ in the intestinal lumen; a high concentration of Na+ on the mucosal surface of the cells facilitates and a low concentration inhibits sugar influx into the epithelial cells. This is because glucose and Na+ share the same cotransporter, or symport, the sodium-dependent glucose transporter. Because the intracellular Na+ concentration is low in intestinal cells as it is in other cells, Na+ moves into the cell along its concentration gradient. Glucose moves with the Na+ and is released in the cell. Hence, symport.</p>\n<p><strong>Highyeild:</strong></p><p>Sodium-glucose Symporter is a transmembrane protein and is an example of sodium-driven Secondary active transport that occurs in the epithelial cells of the small intestines. The sodium-glucose symporter is found on the Apical membrane of the epithelial cells.</p>\n<p><strong>Extraedge:</strong></p><p>Types of Cotransport The sodium-potassium pump is an example of an antiporter as sodium and potassium are pumped in opposite directions This is primary active transport as both molecules are pumped against their gradient and require ATP hydrolysis Glucose uptake in the kidneys is an example of symport as its movement is coupled to the parallel transport of sodium This is secondary active transport as the sodium is moving passively down an electrochemical gradient .</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following increases particle diffusion across the cell membrane :", "options": [{"label": "A", "text": "Increasing lipid solubility of the membrane", "correct": true}, {"label": "B", "text": "Increasing the size of molecule", "correct": false}, {"label": "C", "text": "Increasing the thickness of membrane", "correct": false}, {"label": "D", "text": "All of the above", "correct": false}], "correct_answer": "A. Increasing lipid solubility of the membrane", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Increasing lipid solubility of the membrane Diffusion of Lipid-Soluble Substances through the Lipid Bilayer. An important factor that determines how rapidly a substance diffuses through the lipid bilayer is the lipid solubility of the substance.</p>\n<p><strong>Highyeild:</strong></p><p>For instance, the lipid solubility of oxygen, nitrogen, carbon dioxide, and alcohols are high, and all these substances can dissolve directly in the lipid bilayer and diffuse through the cell membrane in the same manner that diffusion of water solutes occurs in a watery solution. The rate of diffusion of each of these substances through the membrane is directly proportional to its lipid solubility.</p>\n<p><strong>Random:</strong></p><p>Explanation for incorrect Option: - Option: B. The rate of diffusion is inversely proportional to the size of the molecules. This means that the smaller the size of the molecule, the higher is the rate of diffusion. Option: C. Increased surface area increases the rate of diffusion, whereas a thicker membrane reduces it.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 21 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A 17-year-old male develops pneumonia, diabetic ketoacidosis, and metabolic acidosis. Respiratory compensation to a metabolic acidosis consists of hyperventilation to lower the arterial PCO2. The cause of the hyperventilation is described by which of the following statements?", "options": [{"label": "A", "text": "CO2 produced from the reaction of the acid with bicarbonate stimulates central chemoreceptors.", "correct": false}, {"label": "B", "text": "A decrease in the bicarbonate concentration stimulates ventilation.", "correct": false}, {"label": "C", "text": "H+ stimulates central chemoreceptors.", "correct": false}, {"label": "D", "text": "H+ stimulates peripheral chemoreceptors.", "correct": true}], "correct_answer": "D. H+ stimulates peripheral chemoreceptors.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>H+ stimulates peripheral chemoreceptors. A common mistake is thinking that elevated CO2 produced by the reaction of the acid with bicarbonate is the stimulus for ventilation. On the contrary, as soon as the peripheral chemoreceptors sense an increase in the H+, there will be an immediate increase in the rate of ventilation . Physiologically, metabolic acidosis or an initial decrease in pH (an increase in H+) stimulates the peripheral chemoreceptors, resulting in hyperventilation. Hyperventilation leads to a compensatory fall in PCO2.</p>\n<p><strong>Highyeild:</strong></p><p>Chemoreceptors located centrally and in the periphery respond to changes in arterial pH and PCO2 with input to the respiratory center that causes compensatory changes in breathing. Peripheral chemoreceptors are located in the carotid bodies and the aortic bodies and detect changes in pH, O2, and to a lesser extent PCO2. Central chemoreceptors located on the medulla are separated from the blood by the blood-brain barrier. These receptors are bathed by the cerebrospinal fluid (CSF), which is essentially a pure bicarbonate buffer.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Hyperventilation lowers the alveolar PCO2, which lowers the arterial PCO2. This is the appropriate compensatory response because the initial perturbation was a decrease in the bicarbonate concentration from the acid insult. From the Henderson-Hasselbalch equation, it is apparent that a fall in the bicarbonate concentration can be compensated most rapidly by a proportionate fall in CO2.</p>\n<p><strong>Extraedge:</strong></p><p>Respiratory center: Located in the reticular formation of the medulla it is responsible for maintaining a rhythmic cycle of breathing and inte grating neural input from a variety of receptors (e.g. central and peripheral chemoreceptors) to adjust the rate and depth of breathing in response to perturbations in environmental or physical conditions. Central chemoreceptors: Located in the ventrolateral surface of the medulla directly respond to a change in the pH of the CSF, however, since the blood-brain barrier is impermeable to either H+ or HCO3-, these receptors detect changes in the arterial PCO2. Peripheral chemoreceptors: Located on the carotid and aortic bodies these receptors respond directly to changes in the arterial pH, PCO2, and PO2. CO2 / HCO3- buffering system: The central buffering system in the body for maintaining H+ homeostasis. The importance of this buffering system is the ability to control the arterial PCO2 by pulmonary function and [HCO3-] through renal function to compensate for acid-base disturbances.</p>\n<p><strong>Table:</strong></p><p>Respiratory\n center component Primary\n function Pre-Bötzinger\n complex Pacemaker\n cells of spontaneous or automatic breathing Dorsal\n Respiratory Group(DRG) Respiratory\n rhythm generator (inspiratory ramp signal) Ventral\n Respiratory Group (VRG) Overdrive\n mechanism Pneumotaxic\n centre Controls\n the \"switch off\" point of inspiratory ramp signal Apneustic\n centre Delays\n switch off signal- promotes inspiration Vagi Inhibits\n inspiratory discharge</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 29-year-old man who lives at sea level drives up a mountain to a high altitude (20,000 feet) for over 3 hours. Which of the following statements best describes his condition after the elevation climb?", "options": [{"label": "A", "text": "Increased arterial PO2", "correct": false}, {"label": "B", "text": "Decreased arterial PCO2", "correct": true}, {"label": "C", "text": "Decreased arterial pH", "correct": false}, {"label": "D", "text": "Decreased respiratory rate", "correct": false}], "correct_answer": "B. Decreased arterial PCO2", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Decreased arterial PCO2 The partial pressure of oxygen decreases with increasing altitude. Rapid ascent to high altitude can result in hypoxia. Hypoxia stimulates pulmonary ventilation to increase alveolar PO2. A consequence of the hyperventilation is to decrease the PCO2 or hypocapnia. The fall in CO2 shifts the equilibrium of the CO2/HCO3- buffer system to decrease the H+, resulting in respiratory alkalosis.</p>\n<p><strong>Highyeild:</strong></p><p>The main buffer system in the body is the CO /HCO3− buffering system. One of its components, CO2, is controlled by the ventilatory rate; therefore, one of the most effective ways of compensating for an acid or base disturbance is to alter the [CO2] in the blood. Increasing H+ stimulates ventilation, which lowers CO2. Conversely, a fall in [H+] slows ventilation, resulting in a rise in [CO2].</p>\n<p><strong>Extraedge:</strong></p><p>The concentration of CO2 in the blood is controlled by the alveolar PCO2. Hyperventilation decreases the PCO2, and hypoventilation increases the PCO2. Raising the arterial [CO2] causes a hyperventilation with a compensatory decrease, and lowering the [CO2] causes hypoventilation.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 35-year-old man visits his doctor because his wife has long complained of his snoring, but recently observed that his breathing stops for a couple of minutes at a time while he is sleeping. He undergoes polysomnography and ventilatory response testing to ascertain the extent and cause of his sleep apnea. The activity of the central chemoreceptors is stimulated by which of the following?", "options": [{"label": "A", "text": "A decrease in the metabolic rate of the surrounding brain tissue", "correct": false}, {"label": "B", "text": "A decrease in the PO2 of blood flowing through the brain", "correct": false}, {"label": "C", "text": "An increase in the PCO2 of blood flowing through the brain", "correct": true}, {"label": "D", "text": "An increase in the pH of the CSF", "correct": false}], "correct_answer": "C. An increase in the PCO2 of blood flowing through the brain", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>An increase in the PCO2 of blood flowing through the brain An increase in the PCO2 of blood flowing through the brain stimulates the activity of the central chemoreceptors.</p>\n<p><strong>Highyeild:</strong></p><p>Central chemoreceptors are located in the brainstem and are primarily responsible for regulating breathing in response to changes in arterial carbon dioxide (PCO2) levels. As PCO2 levels increase, the central chemoreceptors are stimulated, increasing ventilation to remove excess CO2 from the body.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Changes in PO2 levels or the metabolic rate of surrounding brain tissue do not directly affect the activity of the central chemoreceptors. Option: B. The central chemoreceptors are not stimulated by decreases in PaO2 or blood oxygen content but rather depressed by long-term or severe decreases in oxygen supply. Option: D. An increase in the pH of the cerebrospinal fluid (CSF) may inhibit the activity of the central chemoreceptors, but this is a less potent stimulus compared to changes in PCO2 levels.</p>\n<p><strong>Table:</strong></p><p>Aortic arch transmits via vagus nerve to\nsolitary nucleus of medulla (responds to changes in BP). Carotid sinus (dilated region superior to\nbifurcation of carotid arteries) transmits via glossopharyngeal nerve to\nsolitary nucleus of medulla (responds to changes in BP). Chemoreceptors: • Peripheral-carotid and aortic bodies are\nstimulated by ↑ PCO2, ↓ pH of blood, and ↓ Po₂\n(<60 mm Hg). • Central-are stimulated by changes in pH and\nPco₂ of brain interstitial fluid, which in turn are influenced by arterial CO2\nas H* cannot cross the blood-brain barrier. Do not directly respond to Poz.\nCentral chemoreceptors become less responsive with chronically ↑ PCO₂ (eg,\nCOPD) → ↑ dependence on peripheral chemoreceptors to detect ↓ O₂ to drive\nrespiration. Baroreceptors: • Hypotension-arterial pressure→↓ stretch →↓\nafferent baroreceptor firing → ↑ efferent sympathetic firing and efferent\nparasympathetic stimulation → vasoconstriction, ↑ HR, ↑ contractility, ↑ BP.\nImportant in the response to hypovolemic shock. • Carotid massage-t carotid sinus pressure → ↑\nafferent baroreceptor firing→ ↑ AV node refractory period→ HR →↓ CO. Also leads\nto peripheral vasodilation. Can cause presyncope/syncope. Exaggerated in\nunderlying atherosclerosis, prior neck surgery, older age. • Component of Cushing reflex (triad of\nhypertension, bradycardia, and respiratory depression)—† intracranial pressure\nconstricts arterioles → cerebral ischemia → ↑ PCO₂ and pH → central reflex\nsympathetic ↑ in perfusion pressure (hypertension) ↑ stretch → peripheral\nreflex baroreceptor- induced bradycardia.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Carbon dioxide is transported in blood mainly as:", "options": [{"label": "A", "text": "Free carbon dioxide", "correct": false}, {"label": "B", "text": "Bicarbonate", "correct": true}, {"label": "C", "text": "Carbamino compound", "correct": false}, {"label": "D", "text": "Plasma protein", "correct": false}], "correct_answer": "B. Bicarbonate", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Bicarbonate Carbon dioxide is transported in blood mainly as bicarbonate. Carbon dioxide (CO2) diffuses from the tissues into the red blood cells (RBCs) where it reacts with water (H2O) to form carbonic acid (H2CO3) which then dissociates into hydrogen ions (H+) and bi carbonate ions (HCO3-).</p>\n<p><strong>Highyeild:</strong></p><p>The majority of carbon dioxide is transported in the blood as bicarbonate ions which are carried by the plasma. Some carbon dioxide is also transported in the blood as carbamino compounds, formed by the binding of carbon dioxide to amino groups on hemoglobin, but this is a minor mechanism of transport.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A . Free carbon dioxide is also present in the blood, but it represents a small fraction of the total carbon dioxide transported. Option D . Plasma proteins do not play a significant role in the transport of carbon dioxide.</p>\n<p><strong>Extraedge:</strong></p><p>The CO2 that diffuses into red blood cells is rapidly hydrated to H2CO3 because of the presence of carbonic anhydrase. The H2CO3 dissociates to H+ and HCO3–, and the H+ is buffered, primarily by hemoglobin, while the HCO3– enters the plasma.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 14 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A 32-year-old male who is being treated for acute leukemia develops oliguria. His serum creatinine level is 2.7mg/dL. Renal biopsy reveals multiple uric acid crystals obstructing the renal tubular lumen. The principal site of uric acid precipitation would be which of the following?", "options": [{"label": "A", "text": "Proximal tubules due to high solute concentration (25%)", "correct": false}, {"label": "B", "text": "Proximal tubules due to impaired uric acid transport (20%)", "correct": false}, {"label": "C", "text": "Loop of Henle due to hyposmolarity (7%)", "correct": false}, {"label": "D", "text": "Collecting ducts due to low urine pH (43%)", "correct": true}], "correct_answer": "D. Collecting ducts due to low urine pH (43%)", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Collecting ducts due to low urine pH (43%) Uric acid is soluble at physiological pH. The lowest pH along the nephron is found in the distal tubules and collecting ducts; So these are the segments that become obstructed by uric acid crystals.</p>\n<p><strong>Highyeild:</strong></p><p>Tumor lysis syndrome refers to the constellation of metabolic disturbances that may follow the initiation of cancer treatment. This occurs when large numbers of neoplastic cells are killed rapidly, leading to the release of intracellular ions and metabolic by-products into the systemic circulation. Clinically, the syndrome is characterized by the rapid development of Hyperuricemia Hyperkalaemia Hyperphosphatemia Hypocalcaemia Acute kidney injury</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Uric acid does not precipitate in proximal tubules or Henle’s loop. Option: B. Uric acid does not precipitate in proximal tubules or Henle’s loop. Option: C. Uric acid does not precipitate in proximal tubules or Henle’s loop.</p>\n<p><strong>Extraedge:</strong></p><p>Functions of PCT: Reabsorbs glucose, amino acids, phosphates, potassium, urea and other organic - solutes from the filtrate into the peritubular network. The PCT regulates pH of the filtrates by exchanging hydrogen ions in the interstitium for bicarbonate ions in the filtrate. It is also responsible for secreting organic acids such as creatinine and other bases into the filtrate. Proximal convoluted tubule regulate the pH of the filtrate in the kidneys. Functions of DCT It maintains a proper concentration and pH of the urine. Extra salts, ions of K+, Na+, Cr and H+ secretes from peritubular capillaries into DCT. It secretes ammonium ions and hydrogen ions. It is relatively impermeable to water but in the pressure of Antidiuretic hormone (ADH) its permeability to water increases making urine concentrated.</p>\n<p><strong>Table:</strong></p><p>ELECTROLYTE LOW SERUM CONCENTRATION HIGH SERUM CONCENTRATION Sodium Nausea, malaise, stupor, coma,\n seizures Irritability, stupor, coma Potassium U waves and flattened T waves\n on ECG, arrhythmias, muscle cramps, spasm, weakness Wide QRS and peaked T waves on\n ECG, arrhythmias, muscle weakness Calcium Tetany, seizures, QT\n prolongation, twitching (eg, Chvostek sign), spasm (eg, Trousseau sign) Stones (renal), bones (pain),\n groans (abdominal pain), thrones (↑ urinary frequency), psychiatric overtones\n (anxiety, altered mental status) Magnesium Tetany, torsades de pointes,\n hypokalemia, hypocalcemia (when [Mg2+] < 1.0 mEq/L) + DTRS, lethargy, bradycardia,\n hypotension, cardiac arrest, hypocalcemia Phosphate Bone loss, osteomalacia\n (adults), rickets (children) Renal stones, metastatic\n calcifications, hypocalcemia</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Aldosterone is the mineralocorticoid steroid hormone produced by the zona glomerulosa of the adrenal cortex in the adrenal gland. It plays a central role in the homeostatic regulation of blood pressure, plasma sodium (Na+), and potassium (K+) levels. In the image given below, parts of the nephron are labeled in the alphabet. Select the parts that are the site of action of aldosterone?", "options": [{"label": "A", "text": "E and F", "correct": true}, {"label": "B", "text": "F and G", "correct": false}, {"label": "C", "text": "E and G", "correct": false}, {"label": "D", "text": "Only E", "correct": false}], "correct_answer": "A. E and F", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683534478327-QTDY051002IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>E and F E and F correspond to the late distal tubule and collecting tubule. Aldosterone acts on these sites. The second half of the distal tubule and subsequent cortical collecting tubule have similar functional characteristics. Anatomically, they are composed of two distinct cell types, principal cells, and intercalated cells.</p>\n<p><strong>Highyeild:</strong></p><p>The principal cells reabsorb sodium and water from the lumen and secrete potassium ions into the lumen. Sodium reabsorption and potassium secretion by the principal cells depend on the activity of a Na+-K+ ATPase pump in each cell’s basolateral membrane. This pump maintains a low sodium concentration inside the cell and, therefore, favors sodium diffusion into the cell through special channels Both the late distal tubule and cortical collecting tubule segments reabsorb sodium ions, and the rate of reabsorption is controlled by hormones, especially aldosterone.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. F and G correspond to collecting tubule and collecting duct responsible for the reabsorption of sodium and water Option C. E and G correspond to DCT and collecting duct for reabsorption of sodium water Option D. only E</p>\n<p><strong>Extraedge:</strong></p><p>Locations of Secretion and Reabsorption in the Nephron</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The thick ascending limb of the Loop of Henle and the early distal convoluted tubule are parts of the nephron. The early DCT is lined with the simple cuboidal cells while in the ascending limb epithelium is simple squamous epithelium. Both parts are actively involved in urine formation. Select the common characteristics of both parts in urine formation?", "options": [{"label": "A", "text": "Impermeable to water", "correct": false}, {"label": "B", "text": "Active reabsorption of sodium and chloride ions from the filtrate into the interstitium", "correct": false}, {"label": "C", "text": "Impermeable to sodium and chloride ions", "correct": false}, {"label": "D", "text": "Both A and B have common characteristics", "correct": true}], "correct_answer": "D. Both A and B have common characteristics", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Both A and B have common characteristics First, assume that the loop of Henle is filled with a fluid having a concentration of 300 mOsm/L, the same as that leaving the proximal tubule. Next, the active ion pump of the thick ascending limb on the loop of Henle reduces the concentration inside the tubule and raises the interstitial concentration; this pump establishes a 200-mOsm/ L concentration gradient between the tubular fluid and interstitial fluid.</p>\n<p><strong>Highyeild:</strong></p><p>When the tubular fluid leaves the loop of Henle and flows into the distal convoluted tubule in the renal cortex, the fluid is dilute, with an osmolarity of only about 100 to 140 mOsm/L. The early distal tubule further dilutes the tubular fluid because this segment, like the ascending loop of Henle, actively transports sodium chloride out of the tubule but is relatively impermeable to water.</p>\n<p><strong>Extraedge:</strong></p><p>Summary of Tubule Characteristics-Urine Concentration Structure Active NaCl Transport Permeability H₂O NaCl Urea Proximal tubule ++ ++ + + Thin descending limb 0 ++ + + Thin ascending limb 0 0 + + Thick ascending limb ++ 0 0 0 Distal tubule + +ADH 0 0 Cortical collecting tubule + +ADH 0 0</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A human nephron is shown in an image representing the anatomic location structure of DCT. The distal convoluted tubule (DCT) is divided into early and late segments, termed DCT1 and DCT2, respectively. The connecting tubule (CNT) is located immediately downstream of the DCT2. Select the improper features of DCT1 and DCT2?", "options": [{"label": "A", "text": "DCT 1 forms the macula densa which is part of the JG apparatus", "correct": false}, {"label": "B", "text": "DCT 2 is highly convoluted with reabsorptive features as those of thick segments of the ascending limb of the loop", "correct": false}, {"label": "C", "text": "DCT 2 permeable to water", "correct": true}, {"label": "D", "text": "DCT 2 is called a diluting segment of the nephron", "correct": false}], "correct_answer": "C. DCT 2 permeable to water", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683534478392-QTDY051004IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>DCT 2 permeable to water The next part of the distal tubule is highly convoluted and has many of the same reabsorptive characteristics of the thick segment of the ascending limb of the loop of Henle. That is, it avidly reabsorbs most of the ions, including sodium, potassium, and chloride, but is virtually impermeable to water and urea. For this reason, it is referred to as the diluting segment because it also dilutes the tubular fluid.</p>\n<p><strong>Highyeild:</strong></p><p>The first portion of the distal tubule forms the macula densa, a group of closely packed epithelial cells that is part of the juxtaglomerular complex and provides feedback control of the GFR and blood flow in this same nephron.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. DCT 1 forms the macula densa which is part of the JG apparatus. Option B. The DCT 2 is highly convoluted with reabsorptive features such as those of thick segments of the ascending limb of the loop. Option D. DCT 2 is called the diluting segment of the</p>\n<p><strong>Extraedge:</strong></p><p>The DCT is the shortest segment of the kidney, only 5 mm and it is further divided into two functional units: DCT1 or early DCT DCT2 or late DCT The two units of the DCT are differentiated by their responsiveness to aldosterone. Both DCTs have mineralocorticoid receptors, but only DCT2 expresses 11-beta hydroxysteroid dehydrogenase 2 to inactivate cortisol. 11-beta hydroxysteroid dehydrogenase 2 is also expressed in the connecting tubule and cortical collecting duct.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The distal convoluted tubule is structurally and functionally divisible into two parts. Early DCT and late DCT have specific functions in the process of urine formation. The late DCT performs a function similar to the function of the thick ascending limb of the Loop of Henle. The late DCT possesses characteristic transporters essential for its reabsorptive functions. Select the best-suited justification for transporters in late DCT in nephron?", "options": [{"label": "A", "text": "Occurrence of sodium-chloride cotransporter in the luminal surface of DCT cells", "correct": false}, {"label": "B", "text": "Transport of sodium and chloride ions from the tubular lumen into the cells of late DCT", "correct": false}, {"label": "C", "text": "Na+-K+ ATPase pump exports sodium ions across the basolateral surfaces of cells of late DCT into the interstitium", "correct": false}, {"label": "D", "text": "All best are suited", "correct": true}], "correct_answer": "D. All best are suited", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>All best are suited All justifications are best suited to the function of the late DCT portion of the nephron.</p>\n<p><strong>Highyeild:</strong></p><p>Approximately 5% of the filtered load of sodium chloride is reabsorbed in the early distal tubule. The sodium-chloride co-transporter moves sodium chloride from the tubular lumen into the cell, and the Na+-K+ ATPase pump transports sodium out of the cell across the basolateral membrane. Chloride diffuses out of the cell into the renal interstitial fluid through chloride channels in the basolateral membrane. The thiazide diuretics, which are widely used to treat disorders such as hypertension and heart failure, inhibit the sodium-chloride cotransporter.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. There is an occurrence of sodium-chloride cotransporter in the luminal surface of DCT cells. Option B. It helps in the transport of sodium and chloride ions from the tubular lumen into the cells of late DCT. Option C. The presence of Na+-K+ ATPase pump exports sodium ions across the basolateral surfaces of cells of late DCT into the interstitium</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A male patient at the age of 46 years reported muscle soreness, spasms in leg muscles, numbness in fingers and toes, excessive thirst, and increased frequency of passing urine in the past 2 months. Biochemical parameters serum sodium 150 mmol/L, serum potassium 2.5mmol/L, mild proteinuria, and GFR 120 ml/min were reported. Urine analysis neutral or slightly alkaline urine, urinary potassium concentration was 35 mmol/L. Select the correct statements?", "options": [{"label": "A", "text": "Excess aldosterone secretion", "correct": false}, {"label": "B", "text": "Associated with sodium retention", "correct": false}, {"label": "C", "text": "Increased tubular secretion of potassium", "correct": false}, {"label": "D", "text": "All correct", "correct": true}], "correct_answer": "D. All correct", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>All correct Manifestations are suggestive of Conn syndrome. Excess aldosterone secretion, as occurs in patients with adrenal tumors (Conn syndrome), is associated with sodium retention and decreased plasma potassium concentration due, in part, to excessive potassium secretion by the kidneys.</p>\n<p><strong>Highyeild:</strong></p><p>Although daily regulation of sodium balance can be maintained as long as minimal levels of aldosterone are present, the inability to adjust aldosterone secretion appropriately greatly impairs the regulation of renal potassium excretion and potassium concentration of the body fluids. Thus, aldosterone is even more important as a regulator of potassium concentration than sodium concentration.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. The condition is manifested as excess aldosterone secretion as occurs in patients with adrenal tumors Option B. There is sodium retention in the body and raised plasma osmolarity Option C. Excessive aldosterone acts on the transporter to enhance tubular secretion of potassium leading to hypokalemia and muscle cramps.</p>\n<p><strong>Extraedge:</strong></p><p>Conn syndrome, also known as primary hyperaldosteronism, refers to the excessive secretion of the hormone aldosterone. Aldosterone, secreted by the adrenal glands, plays an important role in the management of blood pressure by regulating sodium and potassium levels in the kidney. By stimulating sodium reabsorption back into the blood and potassium excretion into the urine, aldosterone also causes water to be reabsorbed into the blood vessels. The influx of water into the circulation can lead to high blood pressure. Additionally, low potassium levels can cause muscle cramps and an irregular heartbeat. Typically, aldosterone production is regulated by a protein called renin, however, with Conn syndrome, aldosterone levels are elevated despite normal renin levels.</p>\n<p><strong>Table:</strong></p><p>ELECTROLYTE LOW SERUM\n CONCENTRATION HIGH\n SERUM CONCENTRATION Sodium Nausea,\n malaise, stupor, coma, seizures Irritability,\n stupor, coma Potassium U waves\n and flattened T waves on ECG, arrhythmias, muscle cramps, spasm, weakness Wide QRS\n and peaked T waves on ECG, arrhythmias, muscle weakness Calcium Tetany,\n seizures, QT prolongation, twitching (eg, Chvostek sign), spasm (eg,\n Trousseau sign) Stones\n (renal), bones (pain), groans (abdominal pain), thrones (↑ urinary\n frequency), psychiatric overtones (anxiety, altered mental status) Magnesium Tetany,\n torsades de pointes, hypokalemia, hypocalcemia (when [Mg2+] < 1.0 mEq/L) + DTRS,\n lethargy, bradycardia, hypotension, cardiac arrest, hypocalcemia Phosphate Bone\n loss, osteomalacia (adults), rickets (children) Renal stones,\n metastatic calcifications, hypocalcemia</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Endocrinologist presented a case of a female patient in 34 years with thin skin, central obesity, hypertension, plethoric moon facies, purple striae and easy bruisability, and glucose intolerance. Hematopoietic features of hypercortisolism include leukocytosis, lymphopenia, and eosinopenia. Select the best explanation for Cushing's disease?", "options": [{"label": "A", "text": "Benign adrenal adenoma secreting excess ACTH increased the production of cortisol from the adrenal cortex.", "correct": false}, {"label": "B", "text": "Benign pituitary adenoma secreting excess levels of cortisol.", "correct": false}, {"label": "C", "text": "Benign adrenal adenoma secreting excess levels of cortisol", "correct": false}, {"label": "D", "text": "Benign pituitary adenoma secreting excess ACTH, increased production of cortisol from the adrenal cortex.", "correct": true}], "correct_answer": "D. Benign pituitary adenoma secreting excess ACTH, increased production of cortisol from the adrenal cortex.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Benign pituitary adenoma secreting excess ACTH, increased production of cortisol from the adrenal cortex. The benign pituitary adenoma secreting excess ACTH , increased production of cortisol from the adrenal cortex. The manifestations listed in the statement are suggestive of Cushing syndrome.</p>\n<p><strong>Highyeild:</strong></p><p>Pituitary corticotroph adenomas (Cushing’s disease) account for 70% of patients with endogenous causes of Cushing’s syndrome. ACTH-producing adenomas account for ~10–15% of all pituitary tumors. Because the clinical features of Cushing’s syndrome often lead to early diagnosis, most ACTH-producing pituitary tumors are relatively small microadenomas. Cushing’s disease is 5–10 times more common in women than in men. These pituitary adenomas exhibit unrestrained ACTH secretion, with resultant hypercortisolemia.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Benign adrenal adenomas are noncancerous masses that form in the adrenal glands. Option B. Benign pituitary adenoma secreting excess levels of ACTH and which in turn raises the level of cortisol. Option C. Benign adrenal adenoma secreting excess levels of cortisol. The most common is a noncancerous tumor of the adrenal cortex, called an adrenal adenoma, but only a small fraction of adenomas produce too much cortisol.</p>\n<p><strong>Extraedge:</strong></p><p>Cushing syndrome Clinical manifestations include: “moon” face (very round), buffalo hump (truncal obesity with prominent supraclavicular and dorsal cervical fat pads), protuberant abdomen with accumulation of fatty tissue and stretch marks with purple striae, muscle wasting and weakness, thin extremities, decreased bone density (especially spine), kyphosis and back pain (secondary to bone loss), easy bruising and poor wound healing due to thin and atrophic skin, acne, psychiatric or emotional disturbances, impaired reproductive function (decreased libido and changes in menstrual cycle, and diabetes mellitus. In women, masculinizing effects such as hypertrichosis, breast atrophy, voice changes, and other signs of virilism are noted. Cessation of linear growth is characteristic in children.</p>\n<p><strong>Table:</strong></p><p>Cushing\nConfusions 1. Cushing Disease - It is hypercortisolism due to excess pituitary secretion of ACTH 2. Cushing Syndrome It is a syndrome due to excess cortisol from pituitary, adrenal or\n other sources 3. Cushing Ulcer Seen in Intracranial Injury 4. Cushing Reflex Elevations of intracranial pressure (ICP). 5. Cushing Triads Decrease HR, Irregular Respiration & Widened Pulse Pressure.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Endocrinologists presented a case of a woman at age 57 years with hyperpigmentation on her face as in the image and characteristic sites of darkening are skin creases. Select the one that is an improper explanation of Addison’s disease?", "options": [{"label": "A", "text": "Either glucocorticoid or mineralocorticoid deficiency may come first, but eventually, all patients fail to secrete aldosterone and normal cortisol secretion", "correct": true}, {"label": "B", "text": "Hyponatremia", "correct": false}, {"label": "C", "text": "Hyperkalemia", "correct": false}, {"label": "D", "text": "Severe hypotension", "correct": false}], "correct_answer": "A. Either glucocorticoid or mineralocorticoid deficiency may come first, but eventually, all patients fail to secrete aldosterone and normal cortisol secretion", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Either glucocorticoid or mineralocorticoid deficiency may come first, but eventually, all patients fail to secrete aldosterone and normal cortisol secretion Image describes A 57-year-old female presented with symptoms of primary adrenal insufficiency secondary to autoimmune Addison’s Diffuse skin hyperpigmentation had developed, as illustrated by her facial appearance. The hands demonstrate increased pigmentation of the palmar creases and wrists compared to healthy female control (far right). With long-term glucocorticoid and mineralocorticoid therapy, her hyperpigmentation resolved, as shown by the normal palmar skin pigmentation in the patient. Of note, she wears a medical bracelet indicating her requirement for glucocorticoids in case of severe illness.</p>\n<p><strong>Highyeild:</strong></p><p>In Addison’s disease, there is either glucocorticoid or mineralocorticoid deficiency that may come first, but eventually, all patients fail to secrete both classes of corticosteroid. Patients may present with chronic features and/or acute circulatory shock. With a chronic presentation, initial symptoms are often misdiagnosed as chronic fatigue syndrome or depression. In primary adrenal insufficiency, weight loss is a uniform presenting feature.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Adrenocortical insufficiency should also be considered in patients with hyponatremia, even in the absence of symptoms. Option B. Hyponatremia Option C. Hyperkalemia Option D. Severe hypotension The a bove manifestations are marked in Addison’s disease.</p>\n<p><strong>Extraedge:</strong></p><p>Addison's disease, also known as primary adrenal insufficiency, is a rare long-term endocrine disorder characterized by inadequate production of the steroid hormones cortisol and aldosterone by the two outer layers of the cells of the adrenal glands (adrenal cortex), causing adrenal insufficiency. TYPES OF ADRENAL HORMONES Glucocorticoids — Cortisol is the main glucocorticoid produced by the adrenal gland. Corticotropin (ACTH) is made in the pituitary and stimulates the adrenal gland to produce cortisol. Cortisol has many important functions including: Help to regulate glucose (blood sugar) levels Increase fat in the body Help to defend the body against infection Help the body respond to stress Mineralocorticoids — Aldosterone is the main mineralocorticoid produced by the adrenal glands. It helps to regulate the body's sodium and potassium levels, blood volume, and blood pressure Androgens — Androgen hormones, including testosterone, dehydroepiandrosterone (DHEA), and DHEA sulfate, are present in both men and women. In women, androgens are produced in the adrenal glands and the ovaries. In women, adrenal androgens promote the development of sex characteristics, such as underarm and pubic hair. In men, most androgens (eg, testosterone) are produced in the testes. Testosterone is more important than androgens made by the adrenal glands for normal sexual function.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Select the best-suited differentiating statements between primary hyperaldosteronism from secondary hyperaldosteronism?", "options": [{"label": "A", "text": "With renin high and aldosterone high (secondary hyperaldosteronism)", "correct": false}, {"label": "B", "text": "With renin low and aldosterone high (primary hyperaldosteronism", "correct": false}, {"label": "C", "text": "Inadequate renal perfusion (diuretic therapy, cardiac failure, liver failure, nephrotic syndrome, renal artery stenosis in secondary hyperaldosteronism", "correct": false}, {"label": "D", "text": "All are best-suited statements", "correct": true}], "correct_answer": "D. All are best-suited statements", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>All are best-suited statements</p>\n<p><strong>Highyeild:</strong></p><p>Primary aldosteronism (Hyporeninemic Hyperaldosteronism) was previously thought to be most commonly caused by an adrenal adenoma, termed Conn's syndrome. However, recent studies have shown that bilateral idiopathic adrenal hyperplasia is the cause in up to 70% of cases. Differentiating between the two is important, as this determines treatment. Adrenal carcinoma is an extremely rare cause of primary hyperaldosteronism Secondary hyperaldosteronism It is due to abnormality that indirectly results in pathology through a predictable physiologic pathway, i.e., a renin-producing tumor leads to increased aldosterone, as the body's aldosterone production is normally regulated by renin levels.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Secondary hyperaldosteronism is linked with high plasma renin and high plasma aldosterone levels. Option B. Primary hyperaldosteronism is linked to low plasma renin and high plasma aldosterone levels. Option C. Secondary hyperaldosteronism is linked to Inadequate renal perfusion (diuretic therapy, cardiac failure, liver failure, nephrotic syndrome, renal artery stenosis.</p>\n<p><strong>Extraedge:</strong></p><p>One cause is a juxtaglomerular cell tumor. Another is renal artery stenosis, in which the reduced blood supply across the juxtaglomerular apparatus stimulates the production of renin. Likewise, fibromuscular dysplasia may cause stenosis of the renal artery, and therefore secondary hyperaldosteronism. Other causes can come from the tubules: low reabsorption of sodium (as seen in Bartter and Gitelman syndromes) will lead to hypovolemia/hypotension, which will activate the renin-angiotensin system (RAAS)</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Physiologists determined the reabsorption of sodium ions by the cells of proximal convoluted tubules. He described the initial step in The passive entry of Na+ into the PCT cell across the apical membrane. Select the incorrect?", "options": [{"label": "A", "text": "Intracellular Na+ concentration ([Na+]i) is low", "correct": false}, {"label": "B", "text": "Cell voltage is positive with respect to the lumen", "correct": true}, {"label": "C", "text": "Passive entry of Na+ into the cell across the apical membrane", "correct": false}, {"label": "D", "text": "Transcellular mode of sodium reabsorption", "correct": false}], "correct_answer": "B. Cell voltage is positive with respect to the lumen", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Cell voltage is positive with respect to the lumen The statement \"Cell voltage is positive with respect to the lumen\" is incorrect . The cell voltage is negative with respect to the lumen.</p>\n<p><strong>Highyeild:</strong></p><p>Transcellular transport involves the transportation of solutes by a cell through a cell. Transcellular transport can occur in three different ways: active transport, passive transport, and transcytosis.</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- True statements are:- Option A. The intracellular Na+ concentration ([Na+]) is low Option C. Passive entry of Na+ into the cell across the apical membrane Option D. Above events describe the initial step of the transcellular mode of sodium reabsorption in PCT cells</p>\n<p><strong>Extraedge:</strong></p><p>Basal membrane Apical membrane Active transport Symport with Na+ Na + (exchange for K + ) K + Facilitated diffusion CI - K + Ca ++ CI - Mg ++ Ca ++ HCO 3 - HCO 3 - PO 3 4 - PO 3 4 - Amino acids Amino acids Glucose Glucose Fructose Fructose Galactose Galactose Lactate Lactate Succinate Succinate Citrate Citrate Diffusion between nephron cells K + Ca ++ Mg ++</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Physiologists studied the effect of sodium reabsorption by cells of proximal convoluted tubules in healthy experimental rats. He concluded that kidneys excrete >95% of the ingested Na at rates that match dietary Na intake. Select the incorrect features that enable epithelial cells of PCT in sodium reabsorption?", "options": [{"label": "A", "text": "Renal tubule cells are held by tight junction", "correct": false}, {"label": "B", "text": "Lateral intercellular spaces lie behind the tight junctions and separate the epithelial cells of the tubule.", "correct": false}, {"label": "C", "text": "Sodium is the solute that moves by both transcellular and paracellular pathways", "correct": false}, {"label": "D", "text": "Sodium is the solute that moves by only paracellular pathway", "correct": true}], "correct_answer": "D. Sodium is the solute that moves by only paracellular pathway", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Sodium is the solute that moves by only paracellular pathway The incorrect statement is D. Sodium can move by both transcellular and paracellular pathways in the cells of the proximal convoluted tubule. Sodium ions can move by both transcellular and paracellular pathways</p>\n<p><strong>Highyeild:</strong></p><p>Renal tubular cells, like other epithelial cells, are held together by tight junctions. Lateral intercellular spaces lie behind the tight junctions and separate the epithelial cells of the tubule. Solutes can be reabsorbed or secreted across the cells through the transcellular pathway or between the cells by moving across the tight junctions and intercellular spaces via the paracellular pathway.</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option A. Renal tubule cells in PCT are held by tight junctions Option B. Lateral intercellular spaces lie behind the tight junctions and separate the epithelial cells of the tubule. Option C. Sodium is the solute that moves by both transcellular and paracellular pathways Sodium is a substance that moves through both routes, although most of the sodium is transported through the transcellular pathway.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A male person of age 23 years reported manifestations of passing glucose in urine which he found incidentally in a lab test. Examination and other tests revealed the absence of other manifestations of renal disease. The condition was labeled as isolated renal glycosuria in patients. Select the incorrect reabsorption of glucose by epithelial cells of PCT?", "options": [{"label": "A", "text": "Active transport can move a solute against an electrochemical gradient; this requires energy", "correct": false}, {"label": "B", "text": "Reabsorption of glucose by the renal tubule is an example of secondary active transport", "correct": false}, {"label": "C", "text": "Primary active transport mediates the reabsorption of glucose in the renal tubule", "correct": true}, {"label": "D", "text": "The renal threshold for glucose (RTg) corresponds to a blood glucose level of ~180 mg/dL", "correct": false}], "correct_answer": "C. Primary active transport mediates the reabsorption of glucose in the renal tubule", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Primary active transport mediates the reabsorption of glucose in the renal tubule Primary active transport does not mediate the reabsorption of glucose in the renal tubule</p>\n<p><strong>Highyeild:</strong></p><p>Isolated glycosuria is a non-disease condition characterized by increased urinary glucose excretion but a normal serum glucose level. Transport that is coupled indirectly to an energy source, such as that due to an ion gradient, is referred to as secondary active transport. Reabsorption of glucose by the renal tubule is an example of secondary active transport</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option A. Active transport can move a solute against an electrochemical gradient; this requires energy. Option B. Reabsorption of glucose by the renal tubule is an example of secondary active transport. Option D. Renal threshold for glucose (RTg) corresponds to a blood glucose level of ~180 mg/dL.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The patient at the age of 34 years presented with nausea, vomiting, edema on the face and feet, and low urine output past several weeks. The patient gave H/O for taking medication for the infection in the throat a few days earlier. Examination reported renal failure and decided to estimate the glomerular filtration rate in patients. Select the incorrect?", "options": [{"label": "A", "text": "Para-amino hippuric acid diagnostic for renal failure", "correct": false}, {"label": "B", "text": "A healthy person can clear about 90% of the PAH from the plasma flowing through the kidneys", "correct": false}, {"label": "C", "text": "Clearance of PAH from plasma is elevated in renal failure patient", "correct": true}, {"label": "D", "text": "PAH clearance can be used to estimate the renal plasma flow", "correct": false}], "correct_answer": "C. Clearance of PAH from plasma is elevated in renal failure patient", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Clearance of PAH from plasma is elevated in renal failure patient The rate of clearance of PAH from plasma is reduced in renal failure patients due to reduced glomerular filtration rate.</p>\n<p><strong>Highyeild:</strong></p><p>Para-amino hippurate (PAH) clearance is a method used in renal physiology to measure renal plasma flow, which is a measure of renal function. PAH is completely removed from the blood that passes through the kidneys (PAH undergoes both glomerular filtration and tubular secretion), and therefore the rate at which the kidneys can clear PAH from the blood reflects total renal plasma flow.</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option A. Para-amino hippuric acid (PAH), a derivative of hippuric acid, is a diagnostic agent useful in medical tests involving the kidney used in the measurement of renal plasma flow. Option B. Healthy person can clear about 90% of the PAH from the plasma flowing through the kidneys Option D. PAH clearance can be used to estimate the renal plasma flow.</p>\n<p><strong>Extraedge:</strong></p><p>Para-aminohippuric acid (PAH) It is an amide derivative of the Glycine and Para- aminobenzoic acid. It is not naturally found in human. PAH is secreted very rapidly. An average person can clear about 90% of the PAH from the plasma flowing through the kidneys and excrete it in the urine. It is a diagnostic agent useful in measurement of RPF. It needs to be IV infused before use diagnostically.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Endocrinologist presented a case of polyuria, polydipsia, lethargy, and dyslipidemia with hypertension in a male patient at the age of 67 years. Examination and lab tests were conducted and the patient was diagnosed with type 2 diabetes. Endocrinologists explained the clinical significance of transport maximum for glucose in renal cells. Select the incorrect?", "options": [{"label": "A", "text": "Transport maximum is due to saturation of the specific transporters", "correct": false}, {"label": "B", "text": "The transport maximum for the glucose tubular transport system in adult humans is about 275 mg/min.", "correct": true}, {"label": "C", "text": "Under the normal healthy conditions, no traceable amount of glucose is excreted by tubules", "correct": false}, {"label": "D", "text": "The filtered load of glucose is only about 125 mg/min", "correct": false}], "correct_answer": "B. The transport maximum for the glucose tubular transport system in adult humans is about 275 mg/min.", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The transport maximum for the glucose tubular transport system in adult humans is about 275 mg/min. The transport maximum for the glucose tubular transport system in adult humans is about 375 mg/min.</p>\n<p><strong>Highyeild:</strong></p><p>In physiology, transport maximum refers to the point at which an increase in the concentration of a substance does not increase the movement of a substance across a cell membrane. In renal physiology, the concept of transport maximum is often discussed in the context of glucose and PAH The proximal convoluted tubule of the nephron has protein channels that reabsorb glucose, and others that secrete para-amino hippuric acid (PAH). However, its ability to do so is proportionate to the channel proteins available for transport. Glucose is not secreted, so excretion = filtration - reabsorption. Both filtration and reabsorption are directly proportional to the concentration of glucose in the plasma. However, while the average maximum reabsorption is about 375 mg/min in healthy individuals, filtration has effectively no limit (within reasonable physiological ranges.) Therefore, if the concentration rises above 375 mg/min, the body cannot retain all the glucose, leading to glucosuria.</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option A. Transport maximum for solute is due to saturation of the specific transporters Option C. Under the normal healthy conditions, measurable glucose does not appear in the urine because essentially all the filtered glucose is reabsorbed in the proximal tubule Option D. Filtered load of glucose is only about 125 mg/min</p>\n<p><strong>Extraedge:</strong></p><p>Para-aminohippuric acid (PAH) It is an amide derivative of the Glycine and Para- aminobenzoic acid. It is not naturally found in human. PAH is secreted very rapidly. An average person can clear about 90% of the PAH from the plasma flowing through the kidneys and excrete it in the urine. It is a diagnostic agent useful in measurement of RPF. It needs to be IV infused before use diagnostically.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Water moves across the tight junctions in epithelial cells of PCT by passive diffusion. Physiologists reported a new event that describes the movement of a few solutes with water. Select the correct?", "options": [{"label": "A", "text": "Solvent drag", "correct": true}, {"label": "B", "text": "Facilitative diffusion", "correct": false}, {"label": "C", "text": "Transcellular transport", "correct": false}, {"label": "D", "text": "Co-transport", "correct": false}], "correct_answer": "A. Solvent drag", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Solvent drag Solvent drag, also known as bulk transport, refers to solutes in the ultrafiltrate that are transported back from the renal tubule by the flow of water rather than specifically by ion pumps or other membrane transport proteins. This is a phenomenon primarily in renal physiology, but it also occurs in gastrointestinal physiology.</p>\n<p><strong>Highyeild:</strong></p><p>It generally occurs in the paracellular, rather than transcellular, pathway between the tubular cells. In addition, because the reabsorption of water, organic solutes, and ions is coupled to sodium reabsorption, changes in sodium reabsorption significantly influence the reabsorption of water and many other solutes</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. Facilitative diffusion - molecules diffuse across the plasma membrane with assistance from membrane proteins, such as channels and carriers. A concentration gradient exists for these molecules, so they have the potential to diffuse into (or out of) the cell by moving down it. Option C. Transcellular transport - Transcellular transport involves the transportation of solutes by a cell through a cell. Transcellular transport can occur in three different ways: active transport, passive transport, and transcytosis. Option D. co-transport - Cotransporters are a subcategory of membrane transport proteins (transporters) that couple the favorable movement of one molecule with its concentration gradient and the unfavorable movement of another molecule against its concentration gradient.</p>\n<p><strong>Extraedge:</strong></p><p>Basal membrane Apical membrane Active transport Symport with Na+ Na + (exchange for K + ) K + Facilitated diffusion CI - K + Ca ++ CI - Mg ++ Ca ++ HCO 3 - HCO 3 - PO 3 4 - PO 3 4 - Amino acids Amino acids Glucose Glucose Fructose Fructose Galactose Galactose Lactate Lactate Succinate Succinate Citrate Citrate Diffusion between nephron cells K + Ca ++ Mg ++</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The image given below represents podocytes or pedicels. Podocytes are cells in the visceral layer of Bowman's capsule. These cells surround the capillaries of the glomerulus. Select the incorrect?", "options": [{"label": "A", "text": "Formation of filtration slits in Bowman’s capsule", "correct": false}, {"label": "B", "text": "Inhibit passage of macromolecules through slits", "correct": false}, {"label": "C", "text": "Secrete basement membrane", "correct": false}, {"label": "D", "text": "Helpful in reabsorption", "correct": true}], "correct_answer": "D. Helpful in reabsorption", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683534478528-QTDY051016IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Helpful in reabsorption Podocytes are found lining the Bowman's capsules in the nephrons of the kidney. The foot processes known as pedicels that extend from the podocytes wrap themselves around the capillaries of the glomerulus to form the filtration slits.</p>\n<p><strong>Highyeild:</strong></p><p>The pedicels increase the surface area of the cells enabling efficient ultrafiltration. Podocytes secrete and maintain the basement membrane. There are numerous coated vesicles and coated pits along the basolateral domain of the podocytes which indicate a high rate of vesicular traffic. Podocytes possess a well-developed endoplasmic reticulum and a large Golgi apparatus, indicative of a high capacity for protein synthesis and post-translational modifications. There is also growing evidence of a large number of multivesicular bodies and other lysosomal components seen in these cells, indicating high endocytic activity.</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Options A, B, and C are correct Option A. Formation of filtration slits in Bowman’s capsule Option B. Inhibit the passage of macromolecules through slits Option C. Secrete basement membrane</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Physiologists in a lecture described the ability of nephrons to alter the concentration of urine. Some features of the mechanism are in the image below, Select the incorrect?", "options": [{"label": "A", "text": "System in which the inflow runs in a loop with outflow", "correct": true}, {"label": "B", "text": "System in which inflow is counter to outflow", "correct": false}, {"label": "C", "text": "Inflow is in close proximity to the outflow", "correct": false}, {"label": "D", "text": "Alter the concentration gradient of urine", "correct": false}], "correct_answer": "A. System in which the inflow runs in a loop with outflow", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683534478597-QTDY051017IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>System in which the inflow runs in a loop with outflow Counter current mechanism Is a system in which the inflow runs parallel outflow.</p>\n<p><strong>Highyeild:</strong></p><p>The concentrating mechanism depends on the maintenance of a gradient of increasing osmolality along the medullary pyramids. This gradient is produced by the operation of the loops of Henle as countercurrent multipliers and maintained by the operation of the vasa recta as countercurrent exchangers. A countercurrent system is a system in which the inflow runs parallel to, counter to, and in close proximity to the outflow for some distance. This occurs for both the loops of Henle and the vasa recta in the renal medulla</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option B. Counter current mechanism is a system in which inflow is counter to outflow. Option C. In the Countercurrent mechanism, inflow is in close proximity to the outflow. Option D. Counter current mechanism alters the concentration gradient of urine.</p>\n<p><strong>Extraedge:</strong></p><p>The countercurrent exchange mechanism operates as follows Blood enters and leaves the medulla via the vasa recta at the boundary of the cortex and renal medulla. The vasa recta, like other capillaries, are highly permeable to solutes in the blood, except for the plasma proteins. As blood descends into the medulla toward the papillae, it becomes progressively more concentrated, partly by solute entry from the interstitium and partly by loss of water into the interstitium. By the time the blood reaches the tips of the vasa recta, it has a concentration of about 1200 mosm/l, the same as that of the medullary interstitium. As blood ascends back toward the cortex, it becomes progressively less concentrated as solutes diffuse back out into the medullary interstitium and as water moves into the vasa recta.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The proximal convoluted tubule in the nephron is located between the Bowman's capsule and the loop of the Henle. It serves to resorption of sugar, sodium and chloride ions, and water from the glomerular filtrate. Select the incorrect?", "options": [{"label": "A", "text": "The tubular fluid remains isosmotic in proximal tubules.", "correct": false}, {"label": "B", "text": "Solutes and water are reabsorbed in equal proportions, so little change in osmolarity occurs", "correct": false}, {"label": "C", "text": "Only solutes are reabsorbed from PCT, not water", "correct": true}, {"label": "D", "text": "Proximal tubule fluid has an osmolarity of about 300 mosm/l", "correct": false}], "correct_answer": "C. Only solutes are reabsorbed from PCT, not water", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Only solutes are reabsorbed from PCT, not water Solutes and water are reabsorbed in equal proportions, so little change in osmolarity occurs in PCT.</p>\n<p><strong>Highyeild:</strong></p><p>As fluid passes down the descending loop of Henle, water is reabsorbed by osmosis, and the tubular fluid reaches equilibrium with the surrounding interstitial fluid of the renal medulla, which is very hypertonic—about two to four times the osmolarity of the original glomerular filtrate. Therefore, the tubular fluid becomes more concentrated as it flows into the inner medulla</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option A. Tubular fluid remains isosmotic in proximal tubules. Option B. Solutes and water are reabsorbed in equal proportions, so little change in osmolarity occurs. Option D. Proximal tubule fluid has an osmolarity of about 300 mosm/l. As fluid flows through the proximal tubule, solutes and water are reabsorbed in equal proportions, so little change in osmolarity occurs. Thus, the proximal tubule fluid remains isosmotic to the plasma, with an osmolarity of about 300 mosm/l.</p>\n<p><strong>Extraedge:</strong></p><p>Basal membrane Apical membrane Active transport Symport with Na+ Na + (exchange for K + ) K + Facilitated diffusion CI - K + Ca ++ CI - Mg ++ Ca ++ HCO 3 - HCO 3 - PO 3 4 - PO 3 4 - Amino acids Amino acids Glucose Glucose Fructose Fructose Galactose Galactose Lactate Lactate Succinate Succinate Citrate Citrate Diffusion between nephron cells K + Ca ++ Mg ++</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Male patients aged 23 years reported to nephrologists with increased thirst, frequent passing large amounts of pale urine, weakness, and lethargy. H/o revealed nocturia for the past 4 months. Select the incorrect?", "options": [{"label": "A", "text": "ADH increases the water permeability of distal and cortical collecting tubules", "correct": false}, {"label": "B", "text": "Absence of ADH control on water permeability of distal and cortical collecting tubules", "correct": true}, {"label": "C", "text": "Passing dilute urine with a large amount of water", "correct": false}, {"label": "D", "text": "Injury to the hypothalamus or pituitary gland or genetics, or nephrogenic to diabetes insipidus", "correct": false}], "correct_answer": "B. Absence of ADH control on water permeability of distal and cortical collecting tubules", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Absence of ADH control on water permeability of distal and cortical collecting tubules Vasopressin has three main effects which are: increasing the water permeability of distal and cortical collecting tubules (DCT & CCT), as well as outer and inner medullary collecting duct (OMCD & IMCD) in the kidney, thus allowing water reabsorption and excretion of more concentrated urine, i.e., antidiuresis.</p>\n<p><strong>Highyeild:</strong></p><p>Diabetes insipidus (DI) is a condition characterized by large amounts of dilute urine and increased thirst. The amount of urine produced can be nearly 20 liters per day. Reduction of fluid has little effect on concentration of the urine. Complications may include dehydration or seizures. There are four types of di, each with a different set of causes. Central di (CDI) is due to a lack of the hormone vasopressin (antidiuretic hormone). This can be due to injury to the hypothalamus or pituitary gland or genetics. Nephrogenic di (NDI) occurs when the kidneys do not respond properly to vasopressin</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option A. ADH increases the water permeability of distal and cortical collecting tubules . Option C. Passing dilutes urine with a large amount of water. Option D. Injury to the hypothalamus or pituitary gland or genetics, or nephrogenic to diabetes insipidus.</p>\n<p><strong>Extraedge:</strong></p><p>The mechanism for forming dilute urine is to continue reabsorbing solutes from the distal segments of the tubular system while reducing water reabsorption. In healthy kidneys, fluid leaving the ascending loop of the Henle and early distal tubule is always dilute, regardless of the level of ADH. In the absence of ADH, the urine is further diluted in the late distal tubule and collecting ducts, and a large volume of dilute urine is excreted.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Physiologists described to students about the countercurrent mechanism of concentration of urine. He emphasized the role of a high osmolarity of the renal medullary interstitial fluid, which provides the osmotic gradient necessary for water reabsorption. Select the correct for high osmolarity of the renal medullary interstitial fluid?", "options": [{"label": "A", "text": "Role of countercurrent multiplier", "correct": false}, {"label": "B", "text": "Role of countercurrent exchanger", "correct": false}, {"label": "C", "text": "Loop of Henle", "correct": false}, {"label": "D", "text": "Both a and c correct", "correct": true}], "correct_answer": "D. Both a and c correct", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Both a and c correct Loop of henle is involved in countercurrent multiplier mechanism to create high osmolarity of the renal medullary interstitial fluid. The osmolarity of interstitial fluid in almost all parts of the body is about 300 mosm/l, which is similar to the plasma osmolarity.</p>\n<p><strong>Highyeild:</strong></p><p>The osmolarity of the interstitial fluid in the medulla of the kidney is much higher and may increase progressively to about 1200 to 1400 mosm/l in the pelvic tip of the medulla. This means that the renal medullary interstitium has accumulated solutes in great excess water. Once the high solute concentration in the medulla is achieved, it is maintained by a balanced inflow and outflow of solutes and water in the medulla Active transport of sodium ions and co-transport of potassium, chloride, and other ions out of the thick portion of the ascending limb of the loop of Henle into the medullary interstitium Active transport of ions from the collecting ducts into the medullary interstitium Facilitated diffusion of urea from the inner medullary collecting ducts into the medullary interstitium Diffusion of only small amounts of water from the medullary tubules into the medullary interstitium— far less than the reabsorption of solutes into the medullary interstitium</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B. Vasa recta are involved in the role of countercurrent exchanger</p>\n<p><strong>Extraedge:</strong></p><p>The countercurrent exchange mechanism operates as follows Blood enters and leaves the medulla via the vasa recta at the boundary of the cortex and renal medulla. The vasa recta, like other capillaries, are highly permeable to solutes in the blood, except for the plasma proteins. As blood descends into the medulla toward the papillae, it becomes progressively more concentrated, partly by solute entry from the interstitium and partly by loss of water into the interstitium. By the time the blood reaches the tips of the vasa recta, it has a concentration of about 1200 mosm/l, the same as that of the medullary interstitium. As blood ascends back toward the cortex, it becomes progressively less concentrated as solutes diffuse back out into the medullary interstitium and as water moves into the vasa recta.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Physiologists explained the process of water diuresis and osmotic diuresis and their manifestations in patients. Select the incorrect statement not relevant to the difference between two clinical conditions?", "options": [{"label": "A", "text": "In water diuresis, the volume of water reabsorption in the proximal portions of the nephron is normal,", "correct": false}, {"label": "B", "text": "Urine output can rise to nearly 16 ml/min in water diuresis", "correct": false}, {"label": "C", "text": "In osmotic diuresis, water reabsorption in pct is increased but in DCT is reduced", "correct": true}, {"label": "D", "text": "In osmotic diuresis, urine volume is more than the normal output", "correct": false}], "correct_answer": "C. In osmotic diuresis, water reabsorption in pct is increased but in DCT is reduced", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>In osmotic diuresis, water reabsorption in pct is increased but in DCT is reduced In osmotic diuresis, the osmotic concentration of solute is increased in the lumen of pct leading to increased water excretion in urine.</p>\n<p><strong>Highyeild:</strong></p><p>Diuresis is the increased production of urine by the kidneys, leading to increased excretion of water and electrolytes. Water diuresis and osmotic diuresis are two different types of diuresis with different causes and manifestations in patients. Water diuresis occurs when there is an excess of water in the body or when the body needs to eliminate excess water to maintain fluid balance. Osmotic diuresis, on the other hand, is caused by an increase in the osmotic pressure of the blood, which leads to the excretion of excess water and electrolytes in the urine.</p>\n<p><strong>Random:</strong></p><p>Explanation for Other Options:- Option A. In water diuresis, the volume of water reabsorption in the proximal portions of the nephron is normal, Option B. Urine output can rise to nearly 16 ml/min in water diuresis Option D. In osmotic diuresis, urine volume is more than normal output but certainly less than urine volume in water diuresis. It is important to recognize the difference between osmotic diuresis and water diuresis. In water diuresis, the amount of water reabsorbed in the proximal portions of the nephron is normal, and the maximal urine flow that can be produced is about 16 ml/min. In osmotic diuresis, increased urine flow is due to decreased water reabsorption in the proximal tubules and loops and very large urine flows can be produced.</p>\n<p><strong>Table:</strong></p><p>Primary\npolydipsia and diabetes insipidus Characterized\nby the production of large amounts of dilute urine +/- thirst. Urine specific\ngravity < 1.006. Urine osmolality usually < 300 mOsm/kg. Central DI may\nbe transient if damage is below hypothalamic median eminence or in the\nposterior pituitary (ADH in hypothalamus can still be secreted systemically via\nportal capillaries in median eminence). Primary polydipsia Central DI Nephrogenic DI DEFINITION Excessive water intake ↓ ADH release ADH resistance CAUSES Psychiatric illnesses, hypothalamic lesions affecting thirst center Idiopathic, brain injury (trauma, hypoxia, tumor, surgery,\n infiltrative diseases) Hereditary (ADH receptor mutation), drugs (eg, lithium,\n demeclocycline), hypercalcemia, hypokalemia SERUM OSMOLALITY ↓ ↑ ↑ ADH LEVEL ↓or normal ↓ Normal or t WATER RESTRICTION Significant ↑ in urine osmolality (> 700 mOsm/kg) No change or slight ↑ in urine osmolality No change or slight ↑ in urine osmolality DESMOPRESSIN ADMINISTRATION — Significant t in urine osmolality (>50%) Minimal change in urine osmolality TREATMENT Water restriction Desmopressin (DDAVP) Manage the underlying cause; low-solute diet, HCTZ, amiloride,\n indomethacin No\nwater intake for 2-3 hours followed by hourly measurements of urine volume and\nosmolality as well as plasma Na* concentration and osmolality. Desmopressin\n(ADH analog) is administered if serum osmolality>295-300 mOsm/kg, plasma Na*\n≥ 145 mEq/L, or urine osmolality does not increase despite ↑ plasma osmolality</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Free water clearance by the kidney is increased by which of the following?", "options": [{"label": "A", "text": "Diabetes insipidus", "correct": true}, {"label": "B", "text": "Renal failure", "correct": false}, {"label": "C", "text": "Diuretic therapy", "correct": false}, {"label": "D", "text": "Diabetes mellitus", "correct": false}], "correct_answer": "A. Diabetes insipidus", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Diabetes insipidus Free water clearance refers to the ability of the kidneys to excrete water without affecting the excretion of electrolytes. Diabetes insipidus is a condition where there is a deficiency of antidiuretic hormone (ADH), which normally helps the kidneys reabsorb water. In the absence of ADH, the kidneys excrete large volumes of dilute urine, leading to an increase in free water clearance. Therefore, the correct answer is A. Diabetes insipidus.</p>\n<p><strong>Highyeild:</strong></p><p>Free-water clearance (CH2O) is calculated as the difference between water excretion (urine flow rate) and osmolar clearance Thus, the rate of free-water clearance represents the rate at which solute-free water is excreted by the kidneys. When free-water clearance is positive, excess water is excreted by the kidneys; when free-water clearance is negative, excess solutes are removed from the blood by the kidneys and water is conserved.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B and Option C Renal failure and diuretic therapy can lead to a decrease in free water clearance as they can affect the ability of the kidneys to excrete water without affecting the excretion of electrolytes. Option D. Diabetes mellitus can also lead to a decrease in free water clearance, particularly in cases where there is severe hyperglycemia and osmotic diuresis.</p>\n<p><strong>Table:</strong></p><p>Primary\npolydipsia and diabetes insipidus Characterized\nby the production of large amounts of dilute urine +/- thirst. Urine specific\ngravity < 1.006. Urine osmolality usually < 300 mOsm/kg. Central DI may\nbe transient if damage is below hypothalamic median eminence or in the\nposterior pituitary (ADH in hypothalamus can still be secreted systemically via\nportal capillaries in median eminence). Primary polydipsia Central DI Nephrogenic DI DEFINITION Excessive water intake ↓ ADH release ADH resistance CAUSES Psychiatric illnesses, hypothalamic lesions affecting thirst center Idiopathic, brain injury (trauma, hypoxia, tumor, surgery,\n infiltrative diseases) Hereditary (ADH receptor mutation), drugs (eg, lithium,\n demeclocycline), hypercalcemia, hypokalemia SERUM OSMOLALITY ↓ ↑ ↑ ADH LEVEL ↓or normal ↓ Normal or t WATER RESTRICTION Significant ↑ in urine osmolality (> 700 mOsm/kg) No change or slight ↑ in urine osmolality No change or slight ↑ in urine osmolality DESMOPRESSIN ADMINISTRATION — Significant t in urine osmolality (>50%) Minimal change in urine osmolality TREATMENT Water restriction Desmopressin (DDAVP) Manage the underlying cause; low-solute diet, HCTZ, amiloride,\n indomethacin No\nwater intake for 2-3 hours followed by hourly measurements of urine volume and\nosmolality as well as plasma Na* concentration and osmolality. Desmopressin\n(ADH analog) is administered if serum osmolality>295-300 mOsm/kg, plasma Na*\n≥ 145 mEq/L, or urine osmolality does not increase despite ↑ plasma osmolality</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "In renal disease, albumin is first to appear in urine because:", "options": [{"label": "A", "text": "Of its high concentration in plasma", "correct": false}, {"label": "B", "text": "Has molecular weight slightly greater than the molecules normally getting filtered", "correct": true}, {"label": "C", "text": "High albumin: globulin ratio", "correct": false}, {"label": "D", "text": "Tubular epithelial cells are sensitive to albumin", "correct": false}], "correct_answer": "B. Has molecular weight slightly greater than the molecules normally getting filtered", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Has molecular weight slightly greater than the molecules normally getting filtered The correct answer is B. Has a molecular weight slightly greater than the molecules normally getting filtered.</p>\n<p><strong>Highyeild:</strong></p><p>Albumin is a protein that is normally found in the blood and is too large to pass through the glomerular filtration barrier in the kidneys, which is composed of fenestrated endothelial cells, basement membranes, and podocytes. However, in renal disease, the filtration barrier becomes damaged or more permeable, allowing larger molecules like albumin to pass through into the urine. Albumin has a molecular weight of about 66 kDa, which is slightly larger than the cutoff size of 60 kDa for molecules normally getting filtered by the glomerular filtration barrier. Therefore, in renal disease, albumin is the first protein to appear in the urine because it is small enough to pass through the damaged filtration barrier, while other larger proteins like globulins are still unable to pass through.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Rest Options are inappropriate:- Option A. Of its high concentration in plasma Option C. High albumin: globulin ratio Option D. Tubular epithelial cells are sensitive to albumin</p>\n<p><strong>Extraedge:</strong></p><p>Albumin is restricted from filtration, however, because of its negative charge and the electrostatic repulsion exerted by negative charges of the glomerular capillary wall proteoglycans. In certain kidney diseases, the negative charges on the basement membrane are lost even before there are noticeable changes in kidney histology, a condition referred to as minimal change nephropathy. The cause for this loss of negative charges is still unclear but is believed to be related to an immunological response with abnormal T-cell secretion of cytokines that reduce anions in the glomerular capillary or podocyte proteins. As a result of this loss of negative charges on the basement membranes, some of the lower molecular weight proteins, especially albumin, are filtered and appear in the urine, a condition known as proteinuria or albuminuria.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Absorption of all occurs in PCT except:", "options": [{"label": "A", "text": "PO4", "correct": true}, {"label": "B", "text": "Glucose", "correct": false}, {"label": "C", "text": "HCO3-", "correct": false}, {"label": "D", "text": "H+", "correct": false}], "correct_answer": "A. PO4", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>PO4 Among the options provided, phosphate (PO4) is the only substance that is not absorbed in the PCT. Most of the filtered phosphate is reabsorbed in the more distal parts of the nephron, such as the proximal straight tubule, the loop of Henle, and the distal convoluted tubule. Therefore, the correct answer is A.</p>\n<p><strong>Highyeild:</strong></p><p>The proximal convoluted tubule (PCT) is the first segment of the renal tubule and is responsible for the reabsorption of various substances from the glomerular filtrate. However, not all substances are reabsorbed in the PCT.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option B, C, and D In contrast, glucose, bicarbonate (HCO3-), and hydrogen ions (H+) are all reabsorbed in the PCT. Glucose is actively reabsorbed through the apical and basolateral membranes of PCT cells via sodium-glucose cotransporters (SGLTs) and facilitated diffusion , respectively. Bicarbonate is reabsorbed by a process of Na+/H+ exchange and the activity of carbonic anhydrase. Hydrogen ions are secreted into the lumen of the PCT in exchange for sodium ions, and bicarbonate ions are reabsorbed in the basolateral membrane of the PCT cells.</p>\n<p><strong>Extraedge:</strong></p><p>Basal membrane Apical membrane Active transport Symport with Na+ Na + (exchange for K + ) K + Facilitated diffusion CI - K + Ca ++ CI - Mg ++ Ca ++ HCO 3 - HCO 3 - PO 3 4 - PO 3 4 - Amino acids Amino acids Glucose Glucose Fructose Fructose Galactose Galactose Lactate Lactate Succinate Succinate Citrate Citrate Diffusion between nephron cells K + Ca ++ Mg ++</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following statements is true?", "options": [{"label": "A", "text": "Fluid coming from the descending limb of the loop of Henle is hypotonic", "correct": false}, {"label": "B", "text": "Descending limb of the loop of Henle is permeable to solutes", "correct": false}, {"label": "C", "text": "If clearance of substance is greater than GFR, then tubular secretion must be present", "correct": true}, {"label": "D", "text": "Clearance of a substance is always less than GFR if there is a tubular secretion", "correct": false}], "correct_answer": "C. If clearance of substance is greater than GFR, then tubular secretion must be present", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>If clearance of substance is greater than GFR, then tubular secretion must be present Option C is true. Clearance of a substance is the rate at which that substance is cleared from the blood by the kidneys and is calculated by dividing the urinary excretion rate of the substance by its plasma concentration.</p>\n<p><strong>Highyeild:</strong></p><p>If the clearance of a substance is greater than the glomerular filtration rate (GFR), then tubular secretion must be present as the substance is actively secreted into the tubules in addition to being filtered.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. is False because the descending limb of the loop of Henle is permeable to water, but not to solutes. As a result, water is able to passively diffuse out of the descending limb and into the surrounding interstitial fluid, following the concentration gradient established by the high osmolality of the renal medulla . This leads to the concentration of solutes in the fluid within the descending limb, making it more hypertonic as it descends further down the loop of Henle. Option B. is incorrect because the descending limb of the loop of Henle is not permeable to solutes, only to water. Option D . is false. Clearance of a substance can be greater than GFR if there is tubular secretion, but it can also be equal to or less than GFR depending on the balance of filtration and reabsorption of the substance in the renal tubules.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Hypertension has been observed in a young boy since birth. Which of the following disorders may be present?", "options": [{"label": "A", "text": "Bartter’s syndrome", "correct": false}, {"label": "B", "text": "Gitelman’s syndrome", "correct": false}, {"label": "C", "text": "Liddle’s syndrome", "correct": true}, {"label": "D", "text": "Nephrogenic diabetes insipidus", "correct": false}], "correct_answer": "C. Liddle’s syndrome", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Liddle’s syndrome Liddle's syndrome is a rare genetic disorder that causes hypertension from birth or early childhood. It is caused by mutations in the genes that encode for the epithelial sodium channel (ENaC) in the renal tubules. The mutations result in increased activity of ENaC, leading to increased reabsorption of sodium and water by the renal tubules, and ultimately causing hypertension. Therefore, the most likely disorder present in this young boy is C. Liddle's syndrome.</p>\n<p><strong>Highyeild:</strong></p><p>Patients with Liddle’s syndrome, however, have decreased levels of aldosterone as a result of sodium retention and compensatory decreases in renin secretion and angiotensin II levels, which, in turn, decrease adrenal secretion of aldosterone. Fortunately, Liddle’s syndrome can be treated with the diuretic amiloride, which blocks the excessive ENaC activity.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Options A and B. Bartter's syndrome and Gitelman's syndrome are both genetic disorders that affect the reabsorption of sodium and chloride ions in the renal tubules, but they do not typically cause hypertension from birth. Instead, patients with Bartter's syndrome and Gitelman's syndrome often present with symptoms such as hypotension, hypokalemia, metabolic alkalosis, and polyuria. Option D. Nephrogenic diabetes insipidus is a disorder in which the kidneys are unable to respond to antidiuretic hormone (ADH), resulting in the inability to concentrate urine and causing excessive urination and thirst. Nephrogenic diabetes insipidus can cause dehydration and electrolyte imbalances, but it does not typically cause</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Which of the following is not a component of the countercurrent mechanism?", "options": [{"label": "A", "text": "Thick ascending loop of Henle", "correct": false}, {"label": "B", "text": "Proximal convoluted tubule", "correct": true}, {"label": "C", "text": "Vasa recta", "correct": false}, {"label": "D", "text": "Descending limb of the loop of Henle", "correct": false}], "correct_answer": "B. Proximal convoluted tubule", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Proximal convoluted tubule The countercurrent mechanism is an important process that occurs in the kidneys to establish and maintain the concentration gradient of urine. It involves the interaction between the loops of Henle and the vasa recta. Therefore, the correct answer is B. Proximal convoluted tubule, as this segment of the nephron is not directly involved in the countercurrent mechanism.</p>\n<p><strong>Highyeild:</strong></p><p>The concentrating mechanism depends upon the maintenance of a gradient of increasing osmolality along the medullary pyramids. This gradient is produced by the operation of the loops of Henle as countercurrent multipliers and maintained by the operation of the vasa recta as countercurrent exchangers. A countercurrent system is a system in which the inflow runs parallel to, counter to, and in close proximity to the outflow for some distance. This occurs for both the loops of Henle and the vasa recta in the renal medulla</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- The components of the countercurrent mechanism include: Option A. Thick ascending loop of Henle : This segment of the loop of Henle is impermeable to water and actively transports sodium and chloride ions out of the tubular fluid into the interstitial fluid. This creates a high concentration of solutes in the interstitial fluid, which drives the passive reabsorption of water from the descending limb of the loop of Henle. Option C. Vasa recta: This is a network of blood vessels that runs parallel to the loops of Henle. The vasa recta help to maintain the concentration gradient by carrying away excess water and solutes from the interstitial fluid, preventing their diffusion back into the tubular fluid. Option D. Descending limb of the loop of Henle: This segment of the loop of Henle is permeable to water but impermeable to solutes. As the tubular fluid descends into the medulla, water is passively reabsorbed into the interstitial fluid, which becomes more concentrated as a result.</p>\n<p><strong>Extraedge:</strong></p><p>Basal membrane Apical membrane Active transport Symport with Na+ Na + (exchange for K + ) K + Facilitated diffusion CI - K + Ca ++ CI - Mg ++ Ca ++ HCO 3 - HCO 3 - PO 3 4 - PO 3 4 - Amino acids Amino acids Glucose Glucose Fructose Fructose Galactose Galactose Lactate Lactate Succinate Succinate Citrate Citrate Diffusion between nephron cells K + Ca ++ Mg ++</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 37 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A 13-year-old boy has no movement in his legs after falling out of a tree. Neurological examination shows the absence of both the myotatic (stretch) and reverse myotatic reflexes in the lower extremities. Which of the following is the most important role of the γ motor neurons?", "options": [{"label": "A", "text": "Stimulate skeletal muscle fibers to contract", "correct": false}, {"label": "B", "text": "Maintain IA afferent activity during contraction of muscle", "correct": true}, {"label": "C", "text": "Generate activity in IB afferent fibers", "correct": false}, {"label": "D", "text": "Detect the length of resting skeletal muscle", "correct": false}], "correct_answer": "B. Maintain IA afferent activity during contraction of muscle", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Maintain IA afferent activity during contraction of muscle The absence of both the myotatic (stretch) and reverse myotatic reflexes in the lower extremities suggests damage to the muscle spindle, which is the receptor primarily responsible for the stretch reflex. Gamma (γ) motor neurons play an important role in regulating muscle spindle sensitivity and function, so damage to these neurons could result in the absence of the stretch reflex. Therefore, the correct answer is B, maintain IA afferent activity during contraction of muscle.</p>\n<p><strong>Highyeild:</strong></p><p>The γ motor neurons innervate the intrafusal fibers of the muscle spindles. When a skeletal muscle contracts, the intrafusal muscle fiber becomes slack and the IA afferents stop firing. By stimulating the intrafusal muscle fibers during a contraction, the γ motoneurons prevent the intrafusal muscle fibers from becoming slack and thus maintain IA firing during the contraction. Activation of γ motor neurons causes the contractile ends of the intrafusal fibers to shorten and therefore stretches the nuclear bag portion of the spindles, deforming the endings, and initiating impulses in IA When the whole muscle is stretched, the muscle spindle is also stretched and its sensory endings are activated at a frequency proportional to the degree of stretching (“loading the spindle”). Spindle afferents stop firing when the muscle contracts (“unloading the spindle”). Stimulation of γ-motor neurons causes the contractile ends of the intrafusal fibers to shorten. This stretches the nuclear bag region, initiating impulses in sensory fibers. If the whole muscle is stretched during stimulation of the γ-motor neurons, the rate of discharge in sensory fibers is further increased.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Stimulate skeletal muscle fibers to contract, refers to alpha (α) motor neurons, which innervate extrafusal muscle fibers and directly cause muscle contraction. Option C. Generate activity in IB afferent fibers, is incorrect because IB afferent fibers are not involved in the stretch reflex or the regulation of muscle spindle function. Option D. Detecting the length of resting skeletal muscle, is also incorrect because muscle spindle fibers , not gamma motor neurons, are responsible for detecting changes in muscle length.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Three weeks following a GI infection with Campylobacter jejuni, a 60-year-old male develops weakness and tingling in his legs. Over the next few days, his legs and face become paralyzed, and he is hospitalized with Guillain-Barré Syndrome. Which of the following is the most likely underlying cause of motor paralysis?", "options": [{"label": "A", "text": "Demyelination of B fibers", "correct": false}, {"label": "B", "text": "Demyelination of C fibers", "correct": false}, {"label": "C", "text": "Demyelination of Ab fibers", "correct": true}, {"label": "D", "text": "Antibodies against nerve growth factor", "correct": false}], "correct_answer": "C. Demyelination of Ab fibers", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Demyelination of Ab fibers In Guillain-Barré Syndrome (GBS) Demyelination of Ab fibers is seen.</p>\n<p><strong>Highyeild:</strong></p><p>Guillain-Barré Syndrome (GBS) is an acute, rapidly evolving demyelinating polyradiculopathy that generally manifests as an areflexic ascending motor paralysis and is autoimmune in nature. The basis for flaccid paralysis and sensory disturbance is conduction block in the Ab fibers; axonal conduction remains intact unless there is secondary axonal degeneration. TYPES OF MAMMALIAN NERVE FIBERS table,tr,th,td {border:1px solid black;} Fiber Type Function Fiber Diameter (um) Conduction Velocity (m/sec) Αα Proprioception, somatic motor 12-20 70-120 Aβ Touch, pressure 5-12 30-70 Aγ Motor to muscle spindles 3-6 15-30 Αδ Pain, temperature 2-5 12-30 B Preganglionic autonomic <3 3-15 C, Dorsal root Pain, temperature 0.4-1.2 0.5-2 C, Sympathetic Postganglionic sympathetic 0.3-1.3 0.7-2.3 Most cases are preceded by a viral upper respiratory infection or a GI infection (The most common cause is Campylobacter jejuni ). Twenty to thirty percent of all cases occurring in North America, Europe, and Australia are preceded by infection or reinfection with Campylobacter jejuni . The postulated immunopathogenesis of GBS associated with jejuni infection involves the production of autoantibodies against gangliosides present on the surface of Schwann cells, causing widespread myelin damage. Diagnosis : GBS is a descriptive entity. The diagnosis of AIDP is made by recognizing the pattern of rapidly evolving paralysis with areflexia, absence of fever or other systemic symptoms, and characteristic antecedent events along with CSF findings. In CSF: Consisting of an elevated CSF protein level (1-10 g/L [100-1000 mg/dL]) without accompanying pleocytosis which is called albuminocytologic dissociation. TREATMENT : Treatment should be initiated as soon after diagnosis as possible. Usually, after ~2 weeks after the first motor symptoms, it is not known whether immunotherapy is still effective Either high-dose intravenous immune globulin (IVIg) or plasmapheresis (PLEX can be initiated: Combination is NOT used IVIg is often the initial therapy chosen because of its ease of administration and good safety record Glucocorticoids are not effective in GBS. In the worsening phase of GBS, most patients require monitoring in a critical care setting.</p>\n<p><strong>Table:</strong></p><p>Types of skeletal muscle fibers Muscle fiber type grouping\n commonly occurs due to reinnervation of denervated muscle fibers in\n peripheral nerve damage. Type I Type II CONTRACTION VELOCITY Slow Fast FIBER COLOR Red White PREDOMINANT METABOLISM Oxidative phosphorylation →\n sustained contraction Anaerobic glycolysis MITOCHONDRIA, MYOGLOBIN ↑ ↓ TYPE OF TRAINING Endurance training Weight/resistance training,\n sprinting</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 64-year-old female patient is referred to a neurologist because her sister and brother both suffered recent strokes. She is diagnosed with an antiphospholipid antibody syndrome, a condition that causes hypercoagulation, and placed on warfarin. Despite the anticoagulation therapy, she develops a thrombotic cerebral infarct, which leads to spasticity in her left wrist, elbow, and knee. The lesion most likely affected which of the following?", "options": [{"label": "A", "text": "The corticospinal fibers", "correct": false}, {"label": "B", "text": "The vestibulospinal fibers", "correct": false}, {"label": "C", "text": "The IA afferent fibers", "correct": false}, {"label": "D", "text": "The corticoreticular fibers", "correct": true}], "correct_answer": "D. The corticoreticular fibers", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>The corticoreticular fibers The corticoreticular fibers are most likely affected in this case. Corticoreticular fibers are one of the major output pathways from the motor cortex to the brainstem. It innervates axial muscles and the proximal muscles of the extremities; therefore, it is involved in gait function and postural control.</p>\n<p><strong>Highyeild:</strong></p><p>They project widely and diffusely within the pontomedullary reticular formation. Spasticity results from overactivity of the motor neurons innervating the skeletal musculature. Under normal circumstances, these α motor neurons are tonically stimulated by reticulospinal and vestibulospinal fibers originating in the brainstem. These brainstem fibers are normally inhibited by fibers originating in the cortex. Cutting the cortical fibers releases the brainstem fibers from inhibition and results in spasticity. Cutting the fibers from the reticular formation, vestibular nuclei, or IA afferents will reduce the spasticity.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. The corticospinal tract belongs to one of the most important descending tracts of the CNS. It contains fibers from the upper motor neurons to synapse on the lower motor neurons. Option B. Vestibulospinal tracts are descending tracts present in the spinal cord, i.e., a bundle of nerve fibers that carry information from the higher centers of the brain to the peripheral parts of the body. Option C. A type IA sensory fiber or a primary afferent fiber is a type of afferent nerve fiber. It is the sensory fiber of a stretch receptor called the muscle spindle found in muscles, which constantly monitors the rate at which a muscle stretch changes.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Gamma neurons innervate:", "options": [{"label": "A", "text": "Extrafusal muscle fibers", "correct": false}, {"label": "B", "text": "Intrafusal muscle fibers", "correct": true}, {"label": "C", "text": "Primary motor innervations to skeletal muscles", "correct": false}, {"label": "D", "text": "Inhibit antagonistic muscles", "correct": false}], "correct_answer": "B. Intrafusal muscle fibers", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Intrafusal muscle fibers Gamma motor neurons innervate intrafusal fibers, which do not contribute significantly to muscle force. The function of intrafusal fiber contraction is not to provide force to the muscle; rather, gamma activation of the intrafusal fiber is necessary to keep the muscle spindle taut, and therefore, sensitive to stretch, over a wide range of muscle lengths.</p>\n<p><strong>Highyeild:</strong></p><p>The spindles have a motor nerve supply of their own called γ-motor neurons They are 3–6 µm in diameter and constitute about 30% of the fibers in the ventral roots. There are two types of γ-motor neurons: dynamic which supplies dynamic nuclear bag fibers and static which supplies static nuclear bag fibers and nuclear chain fibers. Activation of dynamic γ-motor neurons increases the dynamic sensitivity of the group Ia endings. Activation of the static γ-motor neurons increases the tonic level of activity in both group Ia and II endings, decreases the dynamic sensitivity of group Ia afferents, and can prevent silencing of Ia afferents during muscle stretch. Diagrammatic representation of the main components of mammalian muscle spindle including intrafusal muscle fibers, afferent sensory fiber endings, and efferent motor fibers (V- motor neurons). B) Three types of intrafusal muscle fibers: dynamic nuclear bag, static nuclear bag, and nuclear chain fibers. A single la afferent fiber innervates all three types of fibers to form a primary sensory ending. A group Il sensory fiber innervates nuclear chain and static bag fibers to form a secondary sensory ending. Dynamic-motor neurons innervate dynamic bag fibers; static v-motor neurons innervate combinations of chain and static bag fibers.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Extrafusal muscle fibers are the standard skeletal muscle fibers that are innervated by alpha motor neurons and generate tension by contracting, thereby allowing for skeletal movement. Option C. Alpha motor neurons or primary lower motor neurons innervate skeletal muscle and cause the muscle contractions that generate movement. Option D. When the inhibitory tone in gamma motor neurons provided by the inhibitory interneuron in the internuncial pool is removed, not innervated.</p>\n<p><strong>Table:</strong></p><p>· Spinal motor neurons · Alpha motor neurons · Innervate skeletal muscle (extrafusal muscle)\nFunction: directly command muscle contract · Gamma motor neurons · Innervate muscle spindle (intrafusal muscle) ns\nFunction: regulating the muscle spindle Lower motor neuro ns · Interneurons · Allows coordinated motor programs to be\ngenerated · Final common pathway · Directly command muscle contract Compare: Upper\nmotor neurons</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "White fibers are present in which muscle?", "options": [{"label": "A", "text": "Calf muscle", "correct": false}, {"label": "B", "text": "Back muscles", "correct": false}, {"label": "C", "text": "Gluteal muscles", "correct": false}, {"label": "D", "text": "Hand muscles", "correct": true}], "correct_answer": "D. Hand muscles", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Hand muscles A deficit of red myoglobin in fast muscle gives it the name white muscle. These are found in hand muscles.</p>\n<p><strong>Highyeild:</strong></p><p>Fast Fibers (Type II, White Muscle): The following are characteristics of fast fibers: Fast fibers are large for great strength of contraction. An extensive sarcoplasmic reticulum is present for the rapid release of calcium ions to initiate contraction. Large amounts of glycolytic enzymes are present for the rapid release of energy by the glycolytic process. Fast fibers have a less extensive blood supply than slow fibers because oxidative metabolism is of secondary importance. Fast fibers have fewer mitochondria than slow fibers, also because oxidative metabolism is secondary.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Red muscle fibers are called slow-twitch fibers as they contract slowly for a long time without experiencing any kind of fatigue. An example of red muscles is the extensor muscles.</p>\n<p><strong>Extraedge:</strong></p><p>Skeletal muscle contains three main fiber types that are distinguished based on several properties:- Type I Slow oxidative Type Ila Fast oxidative glycolytic Type llb Fast glycolytic Fiber & motor unit size Small Intermediate Large Mitochondria and capillaries Many Many Few Myoglobin content High (red fibers) High (red fibers) Low (while fibers) Glycogen content Low Intermediate High Main ATP source Oxidative phosphorylation Oxidative phosphorylation Anaerobic glycolysis Glycolytic enzyme activity Low Intermediate High Rate of fatigue Slow Intermediate Fast Myosin ATPase activity Low High High Contractile speed Slow Fast Fast Examples of major locations Postural muscles of back Major muscles of legs Extraocular eye muscles</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A bundle of muscle cells is found to contract rhythmically and in unison even when its nerve supply is disrupted. Although muscle contractions are dependent on the presence of extracellular calcium, the cells have poorly developed T tubules. Which of the following most likely describes the muscle type?", "options": [{"label": "A", "text": "Cardiac muscle", "correct": false}, {"label": "B", "text": "Fast-twitch skeletal muscle", "correct": false}, {"label": "C", "text": "Unitary smooth muscle", "correct": true}, {"label": "D", "text": "Slow-twitch skeletal muscle", "correct": false}], "correct_answer": "C. Unitary smooth muscle", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Unitary smooth muscle Among the smooth muscles, only unitary smooth muscle can contract rhythmically and in unison without extrinsic innervation. Although all muscles can contract rhythmically and in unison under the right conditions, skeletal muscle can do so only by being activated by its motor nerves .</p>\n<p><strong>Highyeild:</strong></p><p>Unitary smooth muscle: Muscle that contracts and relaxes as a unit. Multiunit smooth muscle: Muscle that, like skeletal muscle, acts independently in contraction and relaxation. All smooth muscles exhibit length–force (tension) relationships similar to those seen in striated muscle, even though sarcomeres are absent in smooth muscle. Calcium initiates contraction by binding with calmodulin, which in turn activates a kinase that phosphorylates smooth muscle myosin, which then can interact with actin.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option A. Cardiac muscle does not need innervation to contract rhythmically in unison and does require extracellular calcium; however, it has highly developed T tubules. Option B. Skeletal muscle also does not require extracellular calcium. Option D. This is a case of smooth muscle, not skeletal muscle.</p>\n<p><strong>Extraedge:</strong></p><p>Many endogenous chemicals and administered drugs act on receptors on smooth muscle membranes to cause contraction or relaxation. The state of contraction of specific smooth muscle results from the interaction of these stimulatory and inhibitory mediators. Not all smooth muscles react the same way to any particular mediator.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 16 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "A 22-year-old female (taking phenelzine) takes a diet supplement containing ephedrine. Activation of the sympathetic nervous system by ephedrine causes tachycardia, palpitations, and contraction of the smooth muscle in which of the following?", "options": [{"label": "A", "text": "Bronchioles", "correct": false}, {"label": "B", "text": "Pupils", "correct": false}, {"label": "C", "text": "Intestine", "correct": false}, {"label": "D", "text": "Arterioles", "correct": true}], "correct_answer": "D. Arterioles", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Arterioles Along with arterioles ephedrine will also act on the β1 receptor and increase heart rate so it affects both arterioles and the heart (the heart is not in the question. So only arterioles is the answer).</p>\n<p><strong>Highyeild:</strong></p><p>Ephedrine is both a direct and indirect sympathomimetic amine (mixed acting) Q which acts on α1, α2, β1, and β2 receptors; however, its primary mode of action is indirectly achieved by inhibiting neuronal norepinephrine reuptake and displacing more norepinephrine from storage vesicles. This action allows norepinephrine to be present in the synapse longer to bind postsynaptic alpha and beta receptors. The binding of ephedrine and released NE leads to vasoconstriction and inotropic and chronotropic action-which leads to tachycardia and palpitations (as given in the question). α1 adrenergic receptors predominate on arteriolar smooth muscle, so these muscles contract when stimulated with norepinephrine and cause increased BP. β1 receptors cause positive inotropic and chronotropic action and increase heart rate and contractility. Cheese reaction Q: Hypertensive reaction resulting from the release of noradrenaline by tyramine (present in cheese; also in higher amounts in older cheese) and other sympathomimetic amines (such as ephedrine) as a consequence of irreversible MAO-A inhibitors (earlier used for depression). In this question drug-drug interaction between phenelzine (MAO-I) (as phenelzine by causing irreversible inhibition of MAO interferes with the metabolism of NE and other catecholamines) and Ephedrine (which prevents the reuptake of NE is there which resulted in this reaction). Ephedrine Diet Pills dramatically accelerate the metabolism without adjusting diet and exercise habits and increasing the metabolism will lead to accelerated weight loss. (such pills are banned by FDA).</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A: Bronchioles: Ephedrine also acts on β2 receptors which lead to bronchodilation but this respons:e is not as marked as CVS effects and not responsible for the symptoms given in the question and hence not the answer. Options B & C - Pupils and intestines are not much affected and are not at all related to symptoms in the question.</p>\n<p><strong>Extraedge:</strong></p><p>Tachyphylaxis: Tachyphylaxis is loss of response to a drug on repeated administration. It is shown by ephedrine due to neuronal depletion of Norepinephrine as the presynaptic end. Serotonin Syndrome : serotonin syndrome occurs when an overdose of a single drug, or concurrent use of several drugs, results in excess serotonergic activity in the central nervous system. 5HT 2 receptors are thought to be involved. Dantrolene is of no value. The neuroleptic malignant syndrome is idiosyncratic and appears to be associated with hypersensitivity to the parkinsonism-inducing effects of D2-blocking antipsychotics in certain individuals. Malignant Hyperthermia is associated with a genetic defect in the RyR1 Q calcium channel of the skeletal muscle sarcoplasmic reticulum that permits uncontrolled calcium release from the sarcoplasmic reticulum when precipitating drugs are given.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 19-year-old male severs an artery in a motorcycle accident. A bystander applies a tourniquet to stop the bleeding. When the paramedics arrived, the blood pressure of the injured man was only slightly hypotensive and his pupils were reactive. The greatest percentage of the redistributed blood volume came from which of the following?", "options": [{"label": "A", "text": "Heart", "correct": false}, {"label": "B", "text": "Aorta", "correct": false}, {"label": "C", "text": "Arteries and arterioles", "correct": false}, {"label": "D", "text": "Venules and veins", "correct": true}], "correct_answer": "D. Venules and veins", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Venules and veins Venules and veins have the greatest percentage of the redistributed blood volume. It means the largest portion of blood at rest is in systemic veins and venules. The greatest percentage of the redistributed blood volume in this case would come from the veins, specifically the venules and veins distal to the site of the tourniquet. This is because the veins are more compliant than arteries and arterioles, and can hold a larger volume of blood.</p>\n<p><strong>Highyeild:</strong></p><p>The total circulating blood volume is approximately 70 mL/kg, about two-thirds of which is found in the systemic veins and venules. A significant volume of blood (9%) is found in pulmonary circulation. The large volume of blood found on the venous side of the circulation is used to adjust circulating blood volume. For example, during hemorrhage, contraction of the veins and venules of the skin increases the amount of blood available for perfusion of the heart and brain. Capacities vessels are considered to be the blood vessels that hold the majority of the blood and can adapt quickly to changes in the amount of blood flowing through them. Veins are typically believed to be the most common type of vein. The venous vasculature contains the biggest amount of blood volume, accounting for 70-80% of total blood volume. As a result, veins are referred to as capacitance vessels in medical terminology.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Blood vessels of internal diameter varying from 5 to 10 μm are the main site of the exchange of substances with the interstitial fluid. These vessels have exclusively tunica intima composed of layers of endothelial cells. In the image given below, Select the correct vessel as explained above and cited in the image?", "options": [{"label": "A", "text": "Capillaries", "correct": true}, {"label": "B", "text": "Arterioles", "correct": false}, {"label": "C", "text": "Venules", "correct": false}, {"label": "D", "text": "Reticular blood vessels", "correct": false}], "correct_answer": "A. Capillaries", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683532111553-QTDY010003IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Capillaries A capillary is a small blood vessel from 5 to 10 micrometers (μm) in diameter. Capillaries are composed of only the tunica intima, consisting of a thin wall of simple squamous endothelial cells. They are the smallest blood vessels in the body: they convey blood between the arterioles and venules. These microvessels are the site of the exchange of many substances with the interstitial fluid surrounding them.</p>\n<p><strong>Highyeild:</strong></p><p>Blood flows from the heart through arteries, which branch and narrow into arterioles, and then branch further into capillaries where nutrients and wastes are exchanged. The capillaries then join and widen to become venules, which in turn widen and converge to become veins, which then return the blood to the heart through the venae cavae. In the mesentery, metarterioles form an additional stage between arterioles and capillaries.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options : Options B and C See the diagram Option D Reticular blood vessels</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The capillary wall performs its function by allowing nutrients and waste substances to pass across it. Molecules larger than 3 nm such as albumin and other large proteins pass through transcellular transport carried inside vesicles, a process that requires them to go through the cells that form the wall. The image provided below represents two types of capillaries. Select the correct red lines marked a and b in the image?", "options": [{"label": "A", "text": "Nerve", "correct": false}, {"label": "B", "text": "Blood capillary", "correct": false}, {"label": "C", "text": "Lymphatic capillary", "correct": false}, {"label": "D", "text": "Correct B and C", "correct": true}], "correct_answer": "D. Correct B and C", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683532111608-QTDY010004IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Correct B and C In Diagram it’s shows Blood capillary (a) and lymphatic capillary (b)</p>\n<p><strong>Highyeild:</strong></p><p>Lymphatic capillaries are similar to blood capillaries, but they are larger in diameter and have closed ends. Unlike blood capillaries, fluid can flow into lymph capillaries but can't flow out through the cell walls. It can only move forward.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Nerve, these are not found in the circulation system. Option: B. Blood capillaries are the tiniest blood vessels of the circulatory system that occur between arteries and veins. Option: C. Lymph capillary, These are the smallest vessels of the lymphatic system, which transport fluid known as lymph. The lymph is formed from plasma that has leaked from blood capillaries along with tissue fluid.</p>\n<p><strong>Extraedge:</strong></p><p>Table comparing Lymphatic Capillaries & Blood Capillaries Characteristics Lymphatic Capillaries Blood Capillaries Definition Capillaries that are found in the lymphatic system Capillaries that are found in the circulatory system Fluid present Interstitial and intercellular fluid which together form a fluid called lymph, which also carries white blood cells Blood consisting of plasma and red blood cells and white blood cells, as well as platelets Structure Microscopic with ends that are closed, made of endothelial cells Microscopic with a single layer of cells forming an endothelium, ends are not closed but form a loop Function Receive and transport filtered blood plasma and interstitial fluid, which forms lymph, and it carries white blood cells which are important in immunity Transports blood and enables gas exchange and the movement of nutrients and wastes into and out of cells Drain into Thoracic duct and right lymphatic duct Venules</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "During early embryonic development, new capillaries are formed through vasculogenesis, the process of blood vessel formation that occurs through a de novo production of endothelial cells that then form vascular tubes. The image describes types of capillaries development after vasculogenesis. Select the correct one?", "options": [{"label": "A", "text": "Continuous-fenestrated-sinusoidal capillaries", "correct": true}, {"label": "B", "text": "Fenestrated-continuous- -sinusoidal capillaries", "correct": false}, {"label": "C", "text": "Continuous- -sinusoidal-fenestrated capillaries", "correct": false}, {"label": "D", "text": "Sinusoidal-continuous-fenestrated capillaries", "correct": false}], "correct_answer": "A. Continuous-fenestrated-sinusoidal capillaries", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683532111657-QTDY010005IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Continuous-fenestrated-sinusoidal capillaries Continuous capillaries are continuous in the sense that the endothelial cells provide an uninterrupted lining, and they only allow smaller molecules, such as water and ions, to pass through their intercellular clefts. There are three types of blood capillaries:- Depiction of the three types of capillaries. The fenestrated type in the center shows small pores called fenestrations; the sinusoidal type on the right shows intercellular gaps and an incomplete basement membrane and is also known as a discontinuous capillary.</p>\n<p><strong>Highyeild:</strong></p><p>Fenestrated capillaries have pores known as fenestrae (Latin for \"windows\") in endothelial cells that are 60–80 nm in diameter. They are spanned by a diaphragm of radially oriented fibrils that allows small molecules and limited amounts of protein to diffuse Sinusoidal capillaries or discontinuous capillaries are a special type of open-pore capillary, also known as a sinusoid, that have wider fenestrations that are 30–40 μm diameters, and wider openings in the endothelium.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The liver harbor a type of endothelium that serves as a location for the mixing of the oxygen-rich blood from the hepatic artery and the nutrient-rich blood from the portal vein. The image below describes a type of capillary in the liver. Select the correct mark in red color?", "options": [{"label": "A", "text": "Continuous capillary", "correct": false}, {"label": "B", "text": "Sinusoidal capillary", "correct": true}, {"label": "C", "text": "Fenestrated capillary", "correct": false}, {"label": "D", "text": "Liver capillary", "correct": false}], "correct_answer": "B. Sinusoidal capillary", "question_images": ["https://dbmi-data.s3.ap-south-1.amazonaws.com/photos-1683532111673-QTDY010006IMG1.JPG"], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Sinusoidal capillary Sinusoidal capillaries or discontinuous capillaries are a special type of open-pore capillary, also known as a sinusoid, that have wider fenestrations that are 30–40 μm diameters, and wider openings in the endothelium.</p>\n<p><strong>Highyeild:</strong></p><p>Fenestrated capillaries have diaphragms that cover the pores whereas sinusoids lack a diaphragm and just have an open pore. These types of blood vessels allow red and white blood cells (7.5 μm – 25 μm diameter) and various serum proteins to pass, aided by a discontinuous basal lamina. These capillaries lack pinocytotic vesicles, and therefore use gaps present in cell junctions to permit transfer between endothelial cells, and hence across the membrane. Sinusoids are irregular spaces filled with blood and are mainly found in the liver, bone marrow, spleen, and brain circumventricular organs</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A male person of the age of 21 years was actively involved in administrative jobs. Suddenly, he suffered an acute attack of giddiness and nausea and he fell on the ground and became unconscious. He regained consciousness with the efforts of his colleagues. He was given a cold drink. A physician was called in and checked his vital parameters. The blood pressure was 80/65 mm Hg. Later on, the Person reported to his family physician for repeated attacks of low blood pressure and unconsciousness over several months. Serum albumin levels were reported to be low in the patient. Select the correct one based on the above findings?", "options": [{"label": "A", "text": "Systemic capillary leak syndrome", "correct": true}, {"label": "B", "text": "Anaphylaxis", "correct": false}, {"label": "C", "text": "Weakness and workload", "correct": false}, {"label": "D", "text": "Adrenal crisis", "correct": false}], "correct_answer": "A. Systemic capillary leak syndrome", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Systemic capillary leak syndrome The symptoms and findings described in the scenario are suggestive of a possible case of systemic capillary leak syndrome (SCLS), also known as Clarkson's disease. Systemic capillary leak syndrome (SCLS) is a rare disorder characterized by acute and severe recurrent attacks associated with a rapid fall in blood pressure as a result of fluid leaks from smaller vessels called capillaries. Attacks often last several days and require emergency care. They are sometimes life-threatening. SCLS occurs most often in adults and the disease is very rare in children.</p>\n<p><strong>Highyeild:</strong></p><p>A chronic form of SCLS has been reported that is manifested by swelling of the extremities and fluid accumulation around the heart and lungs. The characteristic increase in hemoglobin and blood cell count (hematocrit) may be absent in such cases, but serum albumin is characteristically decreased due to the loss of fluid in the tissues.</p>\n<p><strong>Extraedge:</strong></p><p>Systemic capillary leak syndrome (SCLS), also known as Clarkson disease, is a rare disorder in which considerable amounts of plasma and proteins leak from capillaries into surrounding tissue, muscle, and body cavities. As a result, there is a sharp drop in blood pressure - potentially resulting in hypovolemic shock - hypoalbuminemia, and thickened blood due to a decrease in plasma volume (i.e., hemoconcentration).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 17 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">
Instructions
Test Features:
Multiple choice questions with single correct answers
Timer-based testing for realistic exam conditions
Mark questions for review functionality
Comprehensive results and performance analysis
Mobile-optimized interface for learning on-the-go
Start Test
<!-- Quiz Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="quiz"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <!-- Progress Bar --> <div class="w-full bg-gray-200 rounded-full h-3 mb-4"> <div class="progress-bar h-3 rounded-full" id="progress-bar" style="width: 0%"></div> </div> <!-- Question Header --> <div class="flex flex-col md:flex-row justify-between items-center mb-4"> <h2 class="text-lg font-semibold" id="question-number">Question <span>1</span> of 4</h2> <p class="text-lg font-semibold mt-2 md:mt-0" id="timer">Time Remaining: <span>00:00</span></p> </div> <!-- Question Content --> <div class="mb-6" id="question-content"> <p class="text-gray-800 mb-4" id="question-text"></p> <div class="flex flex-wrap gap-4 mb-4" id="question-images"></div> <div class="space-y-3" id="options"></div> </div> <!-- Navigation Buttons --> <div class="flex flex-col md:flex-row justify-between items-center gap-2 md:gap-4"> <div class="flex gap-2 w-full md:w-auto"> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="previous-btn">Previous</button> <button class="bg-[#2c5281] text-white px-4 py-3 w-full md:w-32 h-14 rounded-lg hover:bg-[#2c5281] transition" id="next-btn">Next</button> </div> <div class="flex items-center gap-2"> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="mark-review"> Review <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor"> <path d="M10 2a1 1 0 00-1 1v14l3.293-3.293a1 1 0 011.414 0L17 17V3a1 1 0 00-1-1H10z" /> </svg> </button> <button class="bg-transparent text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-100 transition flex items-center gap-1" id="nav-toggle"> Question 🧭 </button> <button class="bg-green-500 text-white px-6 py-3 w-44 h-14 rounded-lg hover:bg-green-600 transition w-full md:w-auto" id="submit-test">Submit Test</button> </div> </div> </section> <!-- Results Section --> <section class="container mx-auto px-4 md:px-6 pt-4 md:pt-6 pb-1 hidden section-transition" id="results"> <div class="bg-white rounded-lg shadow-md p-4 md:p-6"> <h2 class="text-2xl font-semibold mb-4">Anaesthesia Machine - Results</h2> <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6"> <p><strong>Correct:</strong> <span id="correct-count" class="text-[#000000]">0</span></p> <p><strong>Wrong:</strong> <span id="wrong-count" class="text-[#000000]">0</span></p> <p><strong>Unanswered:</strong> <span id="unanswered-count" class="text-[#000000]-500">0</span></p> <p><strong>Marked for Review:</strong> <span id="marked-count" class="text-[#000000]">0</span></p> </div> <h3 class="text-lg font-semibold mb-4" id="result-question-number">Question <span>1</span> of 4</h3> <div class="space-y-6" id="results-content"></div> <div class="result-nav"> <button aria-label="Previous question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" disabled="" id="prev-result">Previous</button> <button aria-label="Toggle results navigation panel" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="results-nav-toggle">Result 🧭</button> <button aria-label="Next question result" class="result-nav-btn bg-[#2c5281] text-white px-6 py-2 rounded-lg hover:bg-[#2c5281] transition" id="next-result">Next</button> </div> <div class="mt-6 flex space-x-4 button-group md:flex-row flex-col"> <button class="bg-green-500 text-white px-6 py-2 rounded-lg hover:bg-green-600 transition" id="take-again">Take Again</button> </div> </div> </section> <!-- Exit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="exit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Leave Test?</h2> <p class="text-gray-700 mb-4">Your progress will be lost if you leave this page. Are you sure you want to exit?</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="continue-test">No, Continue</button> <button class="bg-red-500 text-white px-4 py-2 rounded-lg hover:bg-red-600 transition" id="exit-test">Yes, Exit</button> </div> </div> </div> <!-- Submit Confirmation Modal --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 hidden" id="submit-modal" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white rounded-lg p-6 max-w-sm w-full"> <h2 class="text-xl font-semibold mb-4">Confirm Submission</h2> <p class="text-gray-700 mb-2">You have attempted <span id="attempted-count">0</span> of 4 questions.</p> <p class="text-gray-700 mb-4"><span id="unattempted-count">0</span> questions are unattempted.</p> <div class="flex justify-end space-x-4"> <button class="bg-gray-300 text-gray-700 px-4 py-2 rounded-lg hover:bg-gray-400 transition" id="cancel-submit">Cancel</button> <button class="text-white px-4 py-2 rounded-lg hover:bg-[#1a365d] transition" style="background-color: #2c5281;" id="confirm-submit">Submit Test</button> </div> </div> </div> <!-- Quiz Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 nav-panel hidden overflow-y-auto" id="nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Questions Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-nav">Close</button> </div> </div> <!-- Results Navigation Panel --> <div class="fixed inset-0 bg-black bg-opacity-50 flex items-start justify-center p-4 z-50 results-nav-panel hidden overflow-y-auto" id="results-nav-panel" style="align-items: flex-start; padding-top: 33vh;"> <div class="bg-white shadow-lg p-4 rounded-lg w-full max-w-2xl max-h-[80vh] overflow-y-auto"> <h2 class="text-lg font-semibold mb-4">Results Navigation</h2> <div class="mb-4"> <select class="w-full p-2 border rounded-lg text-gray-700" id="results-nav-filter"> <option value="all">All Questions</option> <option value="answered">Answered</option> <option value="unanswered">Unanswered</option> <option value="marked">Marked for Review</option> </select> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> </div> <div class="grid grid-cols-5 gap-2 md:gap-3" id="results-nav-grid"></div> <button class="mt-4 bg-gray-500 text-white px-4 py-2 rounded-lg hover:bg-gray-600 transition w-full" id="close-results-nav">Close</button> </div> <!-- JavaScript Logic --> <script> // Enable debug mode for detailed logging const DEBUG_MODE = true; // Log debug messages function debugLog(message) { if (DEBUG_MODE) { console.log(`[DEBUG] ${message}`); } } // Initialize questions with error handling let questions = []; let currentResultQuestion = 0; // State for current question in results try { debugLog("Attempting to parse questions_json"); questions = [{"text": "The response to the antigen used in the tuberculosis skin test, PPD, is not noticeable until 24 to 48 hours after injection, because?", "options": [{"label": "A", "text": "It takes that long for B cells to respond", "correct": false}, {"label": "B", "text": "It takes that long for T cells to respond", "correct": true}, {"label": "C", "text": "It takes that long for neutrophils to arrive at the site", "correct": false}, {"label": "D", "text": "It takes that long for eosinophils to respond", "correct": false}], "correct_answer": "B. It takes that long for T cells to respond", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>It takes that long for T cells to respond Cellular immunity is mediated by T lymphocytes. It is responsible for delayed allergic reactions and the rejection of transplants of foreign tissue.</p>\n<p><strong>Highyeild:</strong></p><p>Cytotoxic T cells attack and destroy cells that have the antigen which activates them. They kill by inserting perforins and by initiating apoptosis. Delayed-reaction allergy is caused by activated T cells and not by antibodies. At the same time, these T cells elicit a cell-mediated type of immune reaction. Cellular immunity constitutes a major defense against infections due to viruses, fungi, and a few bacteria such as the tubercle bacillus.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Options: A, C, and D. Are incorrect options, because B cells take a long time, not other mentioned Cells.</p>\n<p><strong>Extraedge:</strong></p><p>BASIC TYPES OF ACQUIRED IMMUNITY: HUMORAL AND CELL-MEDIATED Two basic but closely allied types of acquired immunity occur in the body. In one of these, the body develops circulating antibodies, which are globulin molecules in the blood plasma capable of attacking the invading agent. This type of immunity is called humoral immunity or B-cell immunity (because B lymphocytes produce the antibodies). The second type of acquired immunity is achieved the through formation of large numbers of activated T lymphocytes that are specifically crafted in the lymph nodes to destroy the foreign agent. This type of immunity is called cell-mediated immunity or T-cell immunity (because the activated lymphocytes are T lymphocytes).</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "What is the process that amplifies the number of T cells or B cells programmed to respond to a specific infectious stimulus?", "options": [{"label": "A", "text": "Haematopoiesis", "correct": false}, {"label": "B", "text": "Hematotherapy", "correct": false}, {"label": "C", "text": "Inflammation", "correct": false}, {"label": "D", "text": "Clonal selection", "correct": true}], "correct_answer": "D. Clonal selection", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Clonal selection Stem cells differentiate into many million different T and B lymphocytes, each with the ability to respond to a particular antigen.</p>\n<p><strong>Highyeild:</strong></p><p>A peptide fragment of it is presented to the appropriate receptors on T cells. In either case, the cells are stimulated to divide, forming clones of cells that respond to this antigen (clonal selection) . When the antigen first enters the body, it can bind directly to the appropriate receptors on B cells. However, a full antibody response requires that the B cells contact helper T cells. In the case of T cells, the antigen is taken up by an antigen-presenting cell and partially digested.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A . Hematopoiesis, formation of blood cellular components , so option A is incorrect. Option: B . Hematotherapy is a treatment and it doesn’t amplify the number of B cells and T cells, so option B is incorrect. Option: C . Inflammation, B cells act as APCs inducing T cell activation and pro-inflammatory cytokine production . But this process doesn’t amplify, so option C is incorrect.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "The function common to neutrophils, monocyte & macrophage is:", "options": [{"label": "A", "text": "Immune response", "correct": false}, {"label": "B", "text": "Phagocytosis", "correct": true}, {"label": "C", "text": "Liberation of histamine", "correct": false}, {"label": "D", "text": "Destruction of old erythrocytes", "correct": false}], "correct_answer": "B. Phagocytosis", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Phagocytosis The function common to neutrophils, monocytes & macrophages is Phagocytosis .</p>\n<p><strong>Highyeild:</strong></p><p>The immune system provides a mechanism for the body to Distinguish its own cells from foreign cells and substances. Destroy the invader by phagocytosis or by producing sensitized lymphocytes or specialized proteins (e.g., antibodies) that either destroy or neutralize the invader.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Immune response, all types of cells take place in an immune response, so it's the least likely option to correct. Option: C. Histamine liberation occurs mainly from the mast cells and basophils. Option: D. Old Red blood cells (RBCs) are normally phagocytized by macrophages of splenic and hepatic sinusoids at 120 days of age, The destruction of RBCs is controlled by antagonist effects of phosphatidylserine (PS) and CD47 on the phagocytic activity of macrophages.</p>\n<p><strong>Extraedge:</strong></p><p>The stages of phagocytosis</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "A 5-year-old child is ill with measles. Blood analysis revealed an increase in the total number of leukocytes up to 13×109/l. Leukogram: basophils - 0, eosinophils - 1, myelocytes - 0, juvenile neutrophils - 0, band neutrophils - 2, segmented neutrophils - 41, lymphocytes - 28, monocytes - 28. What is the name of this phenomenon?", "options": [{"label": "A", "text": "Agranulocytosis", "correct": false}, {"label": "B", "text": "Lymphocytosis", "correct": false}, {"label": "C", "text": "Eosinopenia", "correct": false}, {"label": "D", "text": "Monocytosis", "correct": true}], "correct_answer": "D. Monocytosis", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>This child has increased monocyte content called monocytosis, usually seen in cases of viral infections and inflammation. Normal leukogram has the following indexes: metamyelocytes= 0-1%, stab (band) neutrophils= 1-6%, segmented neutrophils= 47-72%, basophils= 0-1%, eosinophils= 0,5-5%, lymphocytes= 18-37%, monocytes= 3-11%.</p>\n<p><strong>Highyeild:</strong></p><p>The mast cells and basophils release an eosinophil chemotactic factor that causes eosinophils to migrate toward the inflamed allergic tissue.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect options:- Option: A . Agranulocytosis, an extremely low number of granulocytes. Option: B . Lymphocytosis; an increase in white blood cells called lymphocytosis. Option: C. Eosinopenia, defined as a reduced eosinophil count in the</p>\n<p><strong>Extraedge:</strong></p><p>MONOCYTOSIS :- Monocyte count > 10% of total white cell count or greater than 0.8 X 10^9/L. Causes of monocytosis. < Chronic bacterial infections: tuberculosis, brucellosis, bacterial endocarditis, typhoid Connective tissue diseases - SLE, temporal arteritis, rheumatoid arthritis Protozoan infections Chronic neutropenia Hodgkin lymphoma, AML and other malignancies Chronic myelomonocytic leukemia AML, acute myeloblastic leukemia, systemic lupus erythematosus.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "Differentiation of B-lymphocytes into plasma cells leads to the synthesis of immunoglobulins that ensure a specific immune response of the body. Differentiation of B-lymphocytes takes place in the following organ of the immune system:", "options": [{"label": "A", "text": "Bone Marrow", "correct": true}, {"label": "B", "text": "Tonsils", "correct": false}, {"label": "C", "text": "Thymus", "correct": false}, {"label": "D", "text": "Thyroid gland", "correct": false}], "correct_answer": "A. Bone Marrow", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Bone Marrow They are two types, B lymphocytes, and T lymphocytes. B lymphocytes mature in the bone marrow. Whereas T lymphocytes are produced in the bone marrow but mature in the thymus gland.</p>\n<p><strong>Highyeild:</strong></p><p>Fetal stem cells remain in the bone marrow to differentiate into B cells. They are also subjected to selection and differentiation, much like T cells. Self-tolerant B cells go on to produce surface receptors for antigens, divide, and produce immunocompetent B cell clones. These cells disperse throughout the body, colonizing the same organs as T cells. They are abundant in the lymph nodes, spleen, bone marrow, and mucous membranes.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: B. Tonsils are secondary lymphoid tissues. The tonsils are part of MALT (mucosa-associated lymphoid tissue). Option: C. Thymus is the Primary lymphoid Organ, essential for the Development of T Lymphocytes. Option: D. The thyroid gland is Endocrine Gland.</p>\n<p><strong>Extraedge:</strong></p><p>Immune system organs:- Primary organs:- Bone marrow - immune cell production, B cell maturation Thymus -T cell maturation Secondary Organs:- Spleen, lymph nodes, tonsils, Peyer patches Allow immune cells to interact with</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}, {"text": "After honey consumption, a 12-year-old boy had urticaria accompanied by leukocytosis. What type of leukocytosis is it in this case?", "options": [{"label": "A", "text": "Lymphocytosis", "correct": false}, {"label": "B", "text": "Monocytosis", "correct": false}, {"label": "C", "text": "Basophilic leukocytosis", "correct": false}, {"label": "D", "text": "Eosinophilic leukocytosis", "correct": true}], "correct_answer": "D. Eosinophilic leukocytosis", "question_images": [], "explanation_images": [], "explanation": "<p><strong>Solution:</strong></p><p>Eosinophilic leukocytosis Eosinophils have a special propensity to collect in tissues in which allergic reactions occur, such as in the peribronchial tissues of the lungs, in people with asthma and in the skin after allergic skin reactions. This is caused at least partly by the fact that many mast cells and basophils participate in allergic reactions.</p>\n<p><strong>Highyeild:</strong></p><p>The mast cells and basophils release an eosinophil chemotactic factor that causes eosinophils to migrate toward the inflamed allergic tissue. The eosinophils are believed to detoxify some of the inflammation-inducing substances released by the mast cells and basophils and probably also to phagocytize and destroy allergen-antibody complexes, thus preventing the excess spread of the local inflammatory process.</p>\n<p><strong>Random:</strong></p><p>Explanation for Incorrect Options:- Option: A. Lymphocytosis, not seen in Acutely affected urticaria. Option: B. Eosinophils are involved in urticaria, not monocytes. Option: C. Basophilic leukocytosis is uncommon and it can be a sign of myeloproliferative disorder particularly CML.</p>\n<p><strong>Extraedge:</strong></p><p>Causes of Eosinophilia:- Parasites Asthma Chronic adrenal insufficiency Myeloproliferative disorders Allergic processes Neoplasia (eg, Hodgkin lymphoma) Eosinophilic granulomatosis with polyangiitis.</p>\n<p>@dams_new_robot</p>", "bot": "@dams_new_robot", "video": ""}]; if (!Array.isArray(questions) || questions.length === 0) { throw new Error("Questions data is empty or invalid"); } debugLog(`Successfully parsed ${questions.length} questions`); } catch (e) { console.error("Failed to parse questions_json:", e); document.getElementById('error-message').innerHTML = "Error loading quiz data. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; // Fallback to sample questions for testing questions = [ { text: "What is 2 + 2?", options: [ { label: "A", text: "3", correct: false }, { label: "B", text: "4", correct: true }, { label: "C", text: "5", correct: false }, { label: "D", text: "6", correct: false } ], correct_answer: "B. 4", question_images: [], explanation_images: [], explanation: "<p>2 + 2 = 4</p><p>@dams_new_robot</p>", bot: "@dams_new_robot", audio: "", video: "" } ]; debugLog("Loaded fallback questions"); } // Quiz state let currentQuestion = 0; let answers = new Array(questions.length).fill(null); let markedForReview = new Array(questions.length).fill(false); let timeRemaining = 16 * 60; // Duration in seconds let timerInterval = null; const quizId = `{title.replace(/\s+/g, '_').toLowerCase()}`; // Unique ID for local storage // Load saved progress function loadProgress() { try { debugLog("Loading progress from localStorage"); const saved = localStorage.getItem(`quiz_${quizId}`); if (saved) { const { savedAnswers, savedMarked, savedTime } = JSON.parse(saved); answers = savedAnswers || answers; markedForReview = savedMarked || markedForReview; timeRemaining = savedTime !== undefined ? savedTime : timeRemaining; debugLog("Progress loaded successfully"); } else { debugLog("No saved progress found"); } } catch (e) { console.error("Error loading progress:", e); debugLog("Failed to load progress: " + e.message); } } // Save progress function saveProgress() { try { debugLog("Saving progress to localStorage"); localStorage.setItem(`quiz_${quizId}`, JSON.stringify({ savedAnswers: answers, savedMarked: markedForReview, savedTime: timeRemaining })); debugLog("Progress saved successfully"); } catch (e) { console.error("Error saving progress:", e); debugLog("Failed to save progress: " + e.message); } } // Initialize quiz function initQuiz() { try { debugLog("Initializing quiz"); loadProgress(); const startButton = document.getElementById('start-test'); if (!startButton) { throw new Error("Start test button not found"); } startButton.addEventListener('click', startQuiz); debugLog("Start test button listener attached"); document.getElementById('previous-btn').addEventListener('click', showPreviousQuestion); document.getElementById('next-btn').addEventListener('click', showNextQuestion); document.getElementById('mark-review').addEventListener('click', toggleMarkForReview); document.getElementById('nav-toggle').addEventListener('click', toggleNavPanel); document.getElementById('submit-test').addEventListener('click', showSubmitModal); document.getElementById('continue-test').addEventListener('click', closeExitModal); document.getElementById('exit-test').addEventListener('click', () => { debugLog("Exiting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('cancel-submit').addEventListener('click', closeSubmitModal); document.getElementById('confirm-submit').addEventListener('click', submitTest); document.getElementById('take-again').addEventListener('click', () => { debugLog("Restarting test"); localStorage.removeItem(`quiz_${quizId}`); window.location.reload(); }); document.getElementById('review-test').addEventListener('click', () => showResults(currentResultQuestion)); document.getElementById('close-nav').addEventListener('click', toggleNavPanel); document.getElementById('theme-toggle').addEventListener('click', toggleTheme); document.getElementById('nav-filter').addEventListener('change', updateNavPanel); document.getElementById('prev-result').addEventListener('click', showPreviousResult); document.getElementById('next-result').addEventListener('click', showNextResult); document.getElementById('results-nav-toggle').addEventListener('click', toggleResultsNavPanel); document.getElementById('close-results-nav').addEventListener('click', toggleResultsNavPanel); document.getElementById('results-nav-filter').addEventListener('change', updateResultsNavPanel); debugLog("Quiz initialized successfully"); } catch (e) { console.error("Failed to initialize quiz:", e); debugLog("Failed to initialize quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('start-test').disabled = true; } } // Start quiz function startQuiz() { try { debugLog("Starting quiz"); document.getElementById('instructions').classList.add('hidden'); document.getElementById('quiz').classList.remove('hidden'); showQuestion(currentQuestion); startTimer(); updateNavPanel(); debugLog("Quiz started successfully"); } catch (e) { console.error("Error starting quiz:", e); debugLog("Failed to start quiz: " + e.message); document.getElementById('error-message').innerHTML = "Error starting quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); document.getElementById('quiz').classList.add('hidden'); document.getElementById('instructions').classList.remove('hidden'); } } // Show question function showQuestion(index) { try { debugLog(`Showing question ${index + 1}`); currentQuestion = index; const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } document.getElementById('question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('question-text').innerHTML = q.text || "No question text available"; const imagesDiv = document.getElementById('question-images'); imagesDiv.innerHTML = q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg">`).join('') : ''; const optionsDiv = document.getElementById('options'); optionsDiv.innerHTML = q.options && q.options.length > 0 ? q.options.map(opt => ` <button class="option-btn w-full text-left p-3 border rounded-lg ${answers[index] === opt.label ? 'selected' : ''}" onclick="selectOption(${index}, '${opt.label}')" aria-label="Option ${opt.label}: ${opt.text}"> ${opt.label}. ${opt.text} </button> `).join('') : '<p class="text-red-500">No options available</p>'; document.getElementById('previous-btn').disabled = index === 0; document.getElementById('next-btn').disabled = index === questions.length - 1; document.getElementById('mark-review').classList.toggle('marked', markedForReview[index]); updateProgressBar(); saveProgress(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying question:", e); debugLog("Failed to display question: " + e.message); } } // Select option function selectOption(index, label) { try { debugLog(`Selecting option ${label} for question ${index + 1}`); answers[index] = label; const optionsDiv = document.getElementById('options'); const optionButtons = optionsDiv.querySelectorAll('.option-btn'); optionButtons.forEach(btn => { const btnLabel = btn.textContent.trim().split('.')[0]; btn.classList.toggle('selected', btnLabel === label); }); updateNavPanel(); saveProgress(); debugLog(`Option ${label} selected for question ${index + 1}`); } catch (e) { console.error("Error selecting option:", e); debugLog("Failed to select option: " + e.message); } } // Toggle mark for review function toggleMarkForReview() { try { debugLog(`Toggling mark for review on question ${currentQuestion + 1}`); markedForReview[currentQuestion] = !markedForReview[currentQuestion]; document.getElementById('mark-review').classList.toggle('marked', markedForReview[currentQuestion]); updateNavPanel(); saveProgress(); debugLog(`Mark for review toggled for question ${currentQuestion + 1}`); } catch (e) { console.error("Error marking for review:", e); debugLog("Failed to mark for review: " + e.message); } } // Navigate to previous question function showPreviousQuestion() { try { debugLog(`Navigating to previous question from ${currentQuestion + 1}`); if (currentQuestion > 0) { currentQuestion--; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to previous question:", e); debugLog("Failed to navigate to previous question: " + e.message); } } // Navigate to next question function showNextQuestion() { try { debugLog(`Navigating to next question from ${currentQuestion + 1}`); if (currentQuestion < questions.length - 1) { currentQuestion++; showQuestion(currentQuestion); } } catch (e) { console.error("Error navigating to next question:", e); debugLog("Failed to navigate to next question: " + e.message); } } // Handle question navigation click function handleQuestionNavClick(index) { try { debugLog(`Navigating to question ${index + 1} via nav panel`); showQuestion(index); toggleNavPanel(); } catch (e) { console.error("Error handling navigation click:", e); debugLog("Failed to navigate via nav panel: " + e.message); } } // Start timer function startTimer() { try { debugLog("Starting timer"); timerInterval = setInterval(() => { if (timeRemaining <= 0) { debugLog("Timer expired, submitting test"); clearInterval(timerInterval); submitTest(); } else { timeRemaining--; const minutes = Math.floor(timeRemaining / 60); const seconds = timeRemaining % 60; document.getElementById('timer').innerHTML = `Time Remaining: <span>${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}</span>`; saveProgress(); } }, 1000); debugLog("Timer started successfully"); } catch (e) { console.error("Error starting timer:", e); debugLog("Failed to start timer: " + e.message); } } // Update progress bar function updateProgressBar() { try { debugLog("Updating progress bar"); const progress = ((currentQuestion + 1) / questions.length) * 100; document.getElementById('progress-bar').style.width = `${progress}%`; debugLog("Progress bar updated"); } catch (e) { console.error("Error updating progress bar:", e); debugLog("Failed to update progress bar: " + e.message); } } // Update quiz navigation panel function updateNavPanel() { try { debugLog("Updating quiz navigation panel"); const filter = document.getElementById('nav-filter').value; const navGrid = document.getElementById('nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="question-nav-btn ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleQuestionNavClick(${i})" aria-label="Go to Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Quiz navigation panel updated"); } catch (e) { console.error("Error updating quiz navigation panel:", e); debugLog("Failed to update quiz navigation panel: " + e.message); } } // Update results navigation panel function updateResultsNavPanel() { try { debugLog("Updating results navigation panel"); const filter = document.getElementById('results-nav-filter').value; const navGrid = document.getElementById('results-nav-grid'); navGrid.innerHTML = questions.map((_, i) => { if (filter === 'answered' && !answers[i]) return ''; if (filter === 'unanswered' && answers[i]) return ''; if (filter === 'marked' && !markedForReview[i]) return ''; return ` <button class="result-nav-btn-grid ${answers[i] ? 'answered' : 'unanswered'} ${markedForReview[i] ? 'marked-nav' : ''}" onclick="handleResultNavClick(${i})" aria-label="Go to Result for Question ${i + 1}"> ${i + 1} </button> `; }).join(''); debugLog("Results navigation panel updated"); } catch (e) { console.error("Error updating results navigation panel:", e); debugLog("Failed to update results navigation panel: " + e.message); } } // Toggle quiz navigation panel function toggleNavPanel() { try { debugLog("Toggling quiz navigation panel"); const navPanel = document.getElementById('nav-panel'); navPanel.classList.toggle('hidden'); debugLog("Quiz navigation panel toggled"); } catch (e) { console.error("Error toggling quiz navigation panel:", e); debugLog("Failed to toggle quiz navigation panel: " + e.message); } } // Toggle results navigation panel function toggleResultsNavPanel() { try { debugLog("Toggling results navigation panel"); const resultsNavPanel = document.getElementById('results-nav-panel'); resultsNavPanel.classList.toggle('hidden'); if (!resultsNavPanel.classList.contains('hidden')) { updateResultsNavPanel(); } debugLog("Results navigation panel toggled"); } catch (e) { console.error("Error toggling results navigation panel:", e); debugLog("Failed to toggle results navigation panel: " + e.message); } } // Handle result navigation click function handleResultNavClick(index) { try { debugLog(`Navigating to result for question ${index + 1} via nav panel`); showResults(index); toggleResultsNavPanel(); } catch (e) { console.error("Error handling result navigation click:", e); debugLog("Failed to navigate to result: " + e.message); } } // Show submit modal function showSubmitModal() { try { debugLog("Showing submit modal"); const attempted = answers.filter(a => a !== null).length; document.getElementById('attempted-count').textContent = attempted; document.getElementById('unattempted-count').textContent = questions.length - attempted; document.getElementById('submit-modal').classList.remove('hidden'); debugLog("Submit modal displayed"); } catch (e) { console.error("Error showing submit modal:", e); debugLog("Failed to show submit modal: " + e.message); } } // Close submit modal function closeSubmitModal() { try { debugLog("Closing submit modal"); document.getElementById('submit-modal').classList.add('hidden'); debugLog("Submit modal closed"); } catch (e) { console.error("Error closing submit modal:", e); debugLog("Failed to close submit modal: " + e.message); } } // Close exit modal function closeExitModal() { try { debugLog("Closing exit modal"); document.getElementById('exit-modal').classList.add('hidden'); debugLog("Exit modal closed"); } catch (e) { console.error("Error closing exit modal:", e); debugLog("Failed to close exit modal: " + e.message); } } // Submit test function submitTest() { try { debugLog("Submitting test"); clearInterval(timerInterval); document.getElementById('quiz').classList.add('hidden'); document.getElementById('submit-modal').classList.add('hidden'); document.getElementById('results').classList.remove('hidden'); showResults(0); // Start with first question // Trigger confetti animation confetti({ particleCount: 100, spread: 70, origin: { y: 0.6 } }); localStorage.removeItem(`quiz_${quizId}`); debugLog("Test submitted successfully"); } catch (e) { console.error("Error submitting test:", e); debugLog("Failed to submit test: " + e.message); } } // Show result for a single question function showResults(index) { try { debugLog(`Showing result for question ${index + 1}`); currentResultQuestion = index; let correct = 0, wrong = 0, unanswered = 0, marked = 0; answers.forEach((answer, i) => { const isCorrect = answer && questions[i].options.find(opt => opt.label === answer)?.correct; if (answer === null) unanswered++; else if (isCorrect) correct++; else wrong++; if (markedForReview[i]) marked++; }); const q = questions[index]; if (!q) { throw new Error(`Question ${index} is undefined`); } const userAnswer = answers[index]; const isCorrect = userAnswer && q.options.find(opt => opt.label === userAnswer)?.correct; const resultsContent = document.getElementById('results-content'); resultsContent.innerHTML = ` <div class="border p-4 rounded-lg ${isCorrect ? 'bg-green-50' : userAnswer ? 'bg-red-50' : 'bg-gray-50'}"> <p class="font-semibold">Question ${index + 1}: ${q.text || 'No question text'}</p> ${q.question_images && q.question_images.length > 0 ? q.question_images.map(url => `<img src="${url}" alt="Question Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} <p><strong>Your Answer:</strong> ${userAnswer ? `${userAnswer}. ${q.options.find(opt => opt.label === userAnswer)?.text || 'Invalid option'}` : 'Unanswered'}</p> <p><strong>Correct Answer:</strong> ${q.correct_answer || 'Unknown'}</p> <div class="mt-2">${q.explanation || 'No explanation available'}</div> ${q.explanation_images && q.explanation_images.length > 0 ? q.explanation_images.map(url => `<img src="${url}" alt="Explanation Image" class="max-w-full h-auto rounded-lg my-2">`).join('') : ''} ${q.video ? ` <button class="play-video bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadVideo(this, '${q.video}', 'video-${index}')" aria-label="Play explanation video for Question ${index + 1}"> Play Video Explanation </button> <div id="video-${index}" class="video-container mt-2"></div> ` : '<p class="text-gray-500 mt-2">No video available</p>'} ${q.audio ? ` <button class="play-audio bg-blue-500 text-white px-4 py-2 rounded-lg mt-2" onclick="loadAudio(this, '${q.audio}', 'audio-${index}')" aria-label="Play audio explanation for Question ${index + 1}"> Play Audio Explanation </button> <div id="audio-${index}" class="audio-container mt-2"></div> ` : ''} </div> `; document.getElementById('correct-count').textContent = correct; document.getElementById('wrong-count').textContent = wrong; document.getElementById('unanswered-count').textContent = unanswered; document.getElementById('marked-count').textContent = marked; document.getElementById('result-question-number').innerHTML = `Question <span>${index + 1}</span> of ${questions.length}`; document.getElementById('prev-result').disabled = index === 0; document.getElementById('next-result').disabled = index === questions.length - 1; updateResultsNavPanel(); window.scrollTo({ top: 0, behavior: 'smooth' }); debugLog(`Result for question ${index + 1} displayed successfully`); } catch (e) { console.error("Error displaying result:", e); debugLog("Failed to display result: " + e.message); } } // Navigate to previous result function showPreviousResult() { try { debugLog(`Navigating to previous result from question ${currentResultQuestion + 1}`); if (currentResultQuestion > 0) { showResults(currentResultQuestion - 1); } } catch (e) { console.error("Error navigating to previous result:", e); debugLog("Failed to navigate to previous result: " + e.message); } } // Navigate to next result function showNextResult() { try { debugLog(`Navigating to next result from question ${currentResultQuestion + 1}`); if (currentResultQuestion < questions.length - 1) { showResults(currentResultQuestion + 1); } } catch (e) { console.error("Error navigating to next result:", e); debugLog("Failed to navigate to next result: " + e.message); } } // Lazy-load video function loadVideo(button, videoUrl, containerId) { try { debugLog(`Loading video for ${containerId}: ${videoUrl}`); if (!videoUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No video available</p>`; button.remove(); debugLog("No video URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <div class="video-loading"></div> <video controls class="w-full max-w-[600px] rounded-lg" preload="metadata" aria-label="Video explanation"> <source src="${videoUrl}" type="${videoUrl.endsWith('.m3u8') ? 'application/x-mpegURL' : 'video/mp4'}"> Your browser does not support the video tag. </video> `; container.classList.add('active'); button.remove(); // Initialize HLS.js for .m3u8 videos const video = container.querySelector('video'); if (videoUrl.endsWith('.m3u8') && Hls.isSupported()) { const hls = new Hls(); hls.loadSource(videoUrl); hls.attachMedia(video); hls.on(Hls.Events.ERROR, (event, data) => { console.error("HLS.js error:", data); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("HLS.js error: " + JSON.stringify(data)); }); } else if (videoUrl.endsWith('.m3u8') && video.canPlayType('application/vnd.apple.mpegurl')) { video.src = videoUrl; } // Handle video load errors video.onerror = () => { console.error("Video load error for URL:", videoUrl); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; debugLog("Video load error for URL: " + videoUrl); }; // Remove loading spinner when video is ready video.onloadedmetadata = () => { container.querySelector('.video-loading').remove(); debugLog("Video loaded successfully"); }; } catch (e) { console.error("Error loading video:", e); debugLog("Failed to load video: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading video. <a href="${videoUrl}" target="_blank" aria-label="Open video in new tab">Open video</a></p>`; } } // Lazy-load audio function loadAudio(button, audioUrl, containerId) { try { debugLog(`Loading audio for ${containerId}: ${audioUrl}`); if (!audioUrl) { const container = document.getElementById(containerId); container.innerHTML = `<p class="text-gray-500">No audio available</p>`; button.remove(); debugLog("No audio URL provided"); return; } const container = document.getElementById(containerId); container.innerHTML = ` <audio controls class="w-full max-w-[600px]" preload="metadata" aria-label="Audio explanation"> <source src="${audioUrl}" type="audio/mpeg"> Your browser does not support the audio tag. </audio> `; container.classList.add('active'); button.remove(); // Handle audio load errors const audio = container.querySelector('audio'); audio.onerror = () => { console.error("Audio load error for URL:", audioUrl); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; debugLog("Audio load error for URL: " + audioUrl); }; debugLog("Audio loaded successfully"); } catch (e) { console.error("Error loading audio:", e); debugLog("Failed to load audio: " + e.message); const container = document.getElementById(containerId); container.innerHTML = `<p class="text-red-500">Error loading audio. <a href="${audioUrl}" target="_blank" aria-label="Open audio in new tab">Open audio</a></p>`; } } // Toggle dark mode function toggleTheme() { try { debugLog("Toggling theme"); document.documentElement.classList.toggle('dark'); localStorage.setItem('theme', document.documentElement.classList.contains('dark') ? 'dark' : 'light'); debugLog("Theme toggled successfully"); } catch (e) { console.error("Error toggling theme:", e); debugLog("Failed to toggle theme: " + e.message); } } // Load theme preference function loadTheme() { try { debugLog("Loading theme preference"); const theme = localStorage.getItem('theme'); if (theme === 'dark') { document.documentElement.classList.add('dark'); } debugLog("Theme loaded successfully"); } catch (e) { console.error("Error loading theme:", e); debugLog("Failed to load theme: " + e.message); } } // Initialize on DOM content loaded window.addEventListener('DOMContentLoaded', () => { try { debugLog("DOM content loaded, initializing quiz"); loadTheme(); initQuiz(); } catch (e) { console.error("Error during DOMContentLoaded:", e); debugLog("Failed to initialize on DOMContentLoaded: " + e.message); document.getElementById('error-message').innerHTML = "Error initializing quiz. Please check the console for details or contact support."; document.getElementById('error-message').classList.remove('hidden'); } }); </script> </body> </html>" frameborder="0" width="100%" height="2000px">